repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

6fe5949cc2acc298d8c5f64353dcae30ddf399e8

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (23)

+987 / −956 text lines · 1 binary (striped old/new sizes in 64-byte units, not churn) · lines and sizes scale separately

Diff layout

neovim/README.md

Modified

+1 / −1 text lines

3939# todo
41* remove mason
4142* navic highlights do not fit winbar
42* command for toggling case conventions
4343* make highlights more visible when expanding snippets
4444* cursor restore position on (session?) load jumps one location to somewhere
4545 after correct location

neovim/lazy-lock.json

Modified

+12 / −12 text lines

22 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
33 "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
44 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
5 "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
56 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
67 "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
78 "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
910 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
1011 "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
1112 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
12 "conform.nvim": { "branch": "master", "commit": "820eec990d5f332d30cf939954c8672a43a0459e" },
13 "conform.nvim": { "branch": "master", "commit": "a6965ac128eba75537ec2bc5ddd5d5e357062bdc" },
1314 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
1415 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
1516 "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
1617 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
17 "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
18 "gitsigns.nvim": { "branch": "main", "commit": "52f8da33cc0cadbf1164c4a91c8bfd6895533d67" },
1819 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
1920 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
2021 "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
2627 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
2728 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
2829 "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
29 "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
3030 "neorg": { "branch": "main", "commit": "c17b8e9e7327e03f78fbdccfb15abd09ec607bd0" },
3131 "neotest": { "branch": "master", "commit": "f03a78cef74db5638e4312e18b767294a90de8da" },
3232 "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
3434 "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
3535 "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
3636 "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
37 "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
37 "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" },
3838 "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
3939 "nvim-dap-virtual-text": { "branch": "master", "commit": "3e8e207513e6ef520894950acd76b79902714103" },
40 "nvim-genghis": { "branch": "main", "commit": "8613fc1b43db6cc761733b3630eabff9e86296f7" },
40 "nvim-genghis": { "branch": "main", "commit": "1e6855be88e2266c612903dbc337222b59a06e44" },
4141 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
4242 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
4343 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
4747 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
4848 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
4949 "nvim-nio": { "branch": "master", "commit": "5a3a06e5df34f1b4fc1500622b10620c49c60da6" },
50 "nvim-spectre": { "branch": "master", "commit": "2b012554a2536465243c0dff3605b5927c49ed23" },
50 "nvim-spectre": { "branch": "master", "commit": "9653847cf2f225648967f6e9363643e327387579" },
5151 "nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
5252 "nvim-tree.lua": { "branch": "master", "commit": "ddd1d6eb21c45433bdc65cc8015f2457998f2bf2" },
53 "nvim-treesitter": { "branch": "master", "commit": "b350369740e885c85f0f62dd8fe645c6f887ddc6" },
54 "nvim-treesitter-context": { "branch": "master", "commit": "c24a7a6dc5fde325af844d165323aa6f7082866e" },
53 "nvim-treesitter": { "branch": "master", "commit": "baaae36ac709f405c0ee5d39ef9ffd8d8160f1a3" },
54 "nvim-treesitter-context": { "branch": "master", "commit": "e6e71047bb323fb36f5664993a42adaac252bb36" },
5555 "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
5656 "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
5757 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
5858 "nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" },
5959 "nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" },
6060 "nvim-window": { "branch": "main", "commit": "fad0dc96de265b0bdcb21d1071329e5ab1deb4af" },
61 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
61 "oil.nvim": { "branch": "master", "commit": "8bb35eb81a48f14c4a1ef480c2bbb87ceb7cd8bb" },
6262 "overseer.nvim": { "branch": "master", "commit": "dd701ed0639ef1e10d0ca8dec039719e916c4a7b" },
6363 "pair-ls.nvim": { "branch": "master", "commit": "e7a8f55f54a6a1956b782ddefba79dc6bb308d1d" },
6464 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
6565 "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
6666 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
6767 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
68 "schemastore.nvim": { "branch": "main", "commit": "f660f74bcaae950a77c69dda91270063c8cbd692" },
68 "schemastore.nvim": { "branch": "main", "commit": "f7cae6f1b38cb296f48ce1a9c5ed1a419d912a42" },
6969 "specs.nvim": { "branch": "main", "commit": "8a108c8b37dec1b184a1d3d76c6cf867bfbe9636" },
7070 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
7171 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
7272 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
73 "suda.vim": { "branch": "master", "commit": "d0ccc1a5172f6a26182238767e60e08b931d11fa" },
73 "suda.vim": { "branch": "master", "commit": "04469d855e36fffcda6be036eb7ff005f64fa0d6" },
7474 "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
7575 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
7676 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
8181 "tree-sitter-nu": { "branch": "main", "commit": "b090676f0205f52debb93745b9ad788385583276" },
8282 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
8383 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
84 "venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
84 "venn.nvim": { "branch": "main", "commit": "a5430d75875acbe93e9685cdeb78c6eb2a329ed5" },
8585 "vim-vscode-snippets": { "branch": "master", "commit": "812e60d1c648f889328761ec71daff09d1eb3177" },
8686 "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
8787 "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },

neovim/lua/bugabinga/diagnostic.lua

Modified

+73 / −66 text lines

22local auto = require 'std.auto'
33local icon = require 'std.icon'
5local diagnostic_icons = { icon.error, icon.warn, icon.info, icon.hint }
5local diagnostic_icons = { icon.error, icon.warn, icon.info, icon.hint, }
66diagnostic_icons.error = diagnostic_icons[1]
77diagnostic_icons.warn = diagnostic_icons[2]
88diagnostic_icons.info = diagnostic_icons[3]
99diagnostic_icons.hint = diagnostic_icons[4]
1111local display_name = {
12 'Error',
13 'Warning',
14 'Information',
15 'Hint',
12 'Error',
13 'Warning',
14 'Information',
15 'Hint',
1818local diagnostic = vim.diagnostic
1919diagnostic.disable( 0 )
2121auto 'disable_diagnostic_initially' {
22 description = 'Disable Diagnostics initially, when attaching an LSP client to a buffer',
23 events = 'LspAttach',
24 command = function () diagnostic.disable( 0 ) end,
22 description = 'Disable Diagnostics initially, when attaching an LSP client to a buffer',
23 events = 'LspAttach',
24 command = function () diagnostic.disable( 0 ) end,
2727local diagnostic_format = function ( context )
28 return string.format( '%s: %s', display_name[context.severity], context.message )
28 return string.format( '%s: %s', display_name[context.severity], context.message )
2929end
3131local prefix_format = function ( context, index, total )
32 return string.format( '%s/%s %s %s ', index, total, context.source, diagnostic_icons[context.severity] ),
33 'DiagnosticVirtualText' .. display_name[context.severity]
32 return string.format( '%s/%s %s %s ', index, total, context.source, diagnostic_icons[context.severity] ),
33 'DiagnosticVirtualText' .. display_name[context.severity]
3434end
3636diagnostic.config {
5757local sign = function ( options )
58 vim.fn.sign_define( options.name, {
59 text = options.text,
60 texthl = options.name,
61 numhl = nil,
62 culhl = nil,
63 linehl = nil,
64 } )
58 vim.fn.sign_define( options.name, {
59 text = options.text,
60 texthl = options.name,
61 numhl = nil,
62 culhl = nil,
63 linehl = nil,
64 } )
6565end
67sign { name = 'DiagnosticSignError', text = diagnostic_icons.error }
68sign { name = 'DiagnosticSignWarn', text = diagnostic_icons.warn }
69sign { name = 'DiagnosticSignHint', text = diagnostic_icons.hint }
70sign { name = 'DiagnosticSignInfo', text = diagnostic_icons.info }
67sign { name = 'DiagnosticSignError', text = diagnostic_icons.error, }
68sign { name = 'DiagnosticSignWarn', text = diagnostic_icons.warn, }
69sign { name = 'DiagnosticSignHint', text = diagnostic_icons.hint, }
70sign { name = 'DiagnosticSignInfo', text = diagnostic_icons.info, }
7272-- TODO: move to togglers
7373map.normal {
74 description = 'Toggle diagnostics',
75 category = 'diagnostic',
76 keys = '<leader>td',
77 command = function ()
78 if diagnostic.is_disabled( 0 ) then
79 diagnostic.enable( 0 )
80 vim.notify 'Enabling Diagnostics'
81 else
82 diagnostic.disable( 0 )
83 vim.notify 'Disabling Diagnostics'
84 end
85 end,
74 description = 'Toggle diagnostics',
75 category = 'diagnostic',
76 keys = '<leader>td',
77 command = function ()
78 if diagnostic.is_disabled( 0 ) then
79 diagnostic.enable( 0 )
80 vim.notify 'Enabling Diagnostics'
81 else
82 diagnostic.disable( 0 )
83 vim.notify 'Disabling Diagnostics'
84 end
85 end,
8888map.normal {
89 description = 'Show diagnostics under cursor',
90 category = 'diagnostic',
91 keys = 'H',
92 command = diagnostic.open_float,
89 description = 'Show diagnostics under cursor',
90 category = 'diagnostic',
91 keys = 'H',
92 command = diagnostic.open_float,
93}
95map.normal {
96 description = 'Open diagnostics in quickfix list.',
97 category = 'diagnostic',
98 keys = 'HH',
99 command = diagnostic.setqflist,
95102local show_diagnostics_in_buffer = function ()
96 local builtin = require 'telescope.builtin'
97 builtin.diagnostics { bufnr = 0 }
103 local builtin = require 'telescope.builtin'
104 builtin.diagnostics { bufnr = 0, }
98105end
100107map.normal {
101 description = 'Show all diagnostics in buffer',
102 category = 'diagnostic',
103 keys = '<F6>',
104 command = show_diagnostics_in_buffer,
108 description = 'Show all diagnostics in buffer',
109 category = 'diagnostic',
110 keys = '<F6>',
111 command = show_diagnostics_in_buffer,
107114local show_diagnostics_in_workspace = function ()
108 local builtin = require 'telescope.builtin'
109 builtin.diagnostics()
115 local builtin = require 'telescope.builtin'
116 builtin.diagnostics()
110117end
112119map.normal {
113 description = 'Show all diagnostics in workspace',
114 category = 'diagnostic',
115 keys = '<F6><F6>',
116 command = show_diagnostics_in_workspace,
120 description = 'Show all diagnostics in workspace',
121 category = 'diagnostic',
122 keys = '<F6><F6>',
123 command = show_diagnostics_in_workspace,
119126-- a little debug helper to show all kinds of diagnostics
121128local dia = function ( severity, line )
122 local ns = vim.api.nvim_create_namespace( 'test' .. tostring( severity ) )
123 local bufnr = vim.api.nvim_get_current_buf()
124 local options = {
125 bufnr = bufnr,
126 lnum = line,
127 end_lnum = line,
128 col = 0,
129 severity = severity,
130 message = 'This is a test ' .. tostring( severity ) .. ' diagnostic',
131 }
129 local ns = vim.api.nvim_create_namespace( 'test' .. tostring( severity ) )
130 local bufnr = vim.api.nvim_get_current_buf()
131 local options = {
132 bufnr = bufnr,
133 lnum = line,
134 end_lnum = line,
135 col = 0,
136 severity = severity,
137 message = 'This is a test ' .. tostring( severity ) .. ' diagnostic',
138 }
133 vim.diagnostic.set( ns, bufnr, { options } )
134 vim.diagnostic.show( ns, bufnr, { options } )
140 vim.diagnostic.set( ns, bufnr, { options, } )
141 vim.diagnostic.show( ns, bufnr, { options, } )
135142end
137144local send_dia = function ()
138 dia( vim.diagnostic.severity.ERROR, 1 )
139 dia( vim.diagnostic.severity.WARN, 2 )
140 dia( vim.diagnostic.severity.INFO, 3 )
141 dia( vim.diagnostic.severity.HINT, 4 )
145 dia( vim.diagnostic.severity.ERROR, 1 )
146 dia( vim.diagnostic.severity.WARN, 2 )
147 dia( vim.diagnostic.severity.INFO, 3 )
148 dia( vim.diagnostic.severity.HINT, 4 )
142149end
144151vim.g.send_dia = send_dia

neovim/lua/bugabinga/lsp/init.lua

Modified

+414 / −379 text lines

1local debug = require 'std.dbg'
1local dbg = require 'std.dbg'
22local icon = require 'std.icon'
33local defer = require 'std.defer'
44local map = require 'std.map'
1515require 'bugabinga.lsp.lightbulb'
1717local token_update = function ( lsp_client )
18 local token = lsp_client.data.token
19 local buffer = lsp_client.buffer
20 local client_id = lsp_client.data.client_id
21 local mutable_variable_highlight = 'MutableVariable'
18 local token = lsp_client.data.token
19 local buffer = lsp_client.buffer
20 local client_id = lsp_client.data.client_id
21 local mutable_variable_highlight = 'MutableVariable'
23 if token.type == 'variable' and not token.modifiers.readonly then
24 vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
25 end
23 if token.type == 'variable' and not token.modifiers.readonly then
24 vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
25 end
27 --TODO: find more use cases for semantic tokens
28 --* global variables
29 --* functions with side effects
30 --* closures that capture something
27 --TODO: find more use cases for semantic tokens
28 --* global variables
29 --* functions with side effects
30 --* closures that capture something
3131end
3333local expand_path = function ( path )
34 if vim.fn.executable( path ) == 1 then
35 return vim.fn.exepath( path )
36 else
37 return path
38 end
34 if vim.fn.executable( path ) == 1 then
35 return vim.fn.exepath( path )
36 else
37 return path
38 end
3939end
4141local expand_command = function ( command )
42 vim.validate { command = { command, { 'string', 'table', }, }, }
42 vim.validate { command = { command, { 'string', 'table', }, }, }
44 if type( command ) == 'table' then
45 command[1] = expand_path( command[1] )
46 return command
47 end
44 if type( command ) == 'table' then
45 command[1] = expand_path( command[1] )
46 return command
47 end
49 return expand_path( command )
49 return expand_path( command )
5050end
5252local lsp_start = function ( file_type_event )
53 debug.print 'trying to start lsp'
54 local match = file_type_event.match
53 dbg.print 'trying to start lsp'
54 local match = file_type_event.match
56 debug.print( 'filetypes to ignore', ignored.filetypes, 'current filetype', match )
57 if vim.iter( ignored.filetypes ):find( match ) then return end
56 dbg.print( 'filetypes to ignore', ignored.filetypes, 'current filetype', match )
57 if vim.iter( ignored.filetypes ):find( match ) then return end
59 local bufnr = file_type_event.buf
60 local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr, } )
61 debug.print( 'buftypes to ignore', ignored.buftypes, 'current buftype', buftype )
62 if vim.iter( ignored.buftypes ):find( buftype ) then return end
59 local bufnr = file_type_event.buf
60 local buftype = vim.api.nvim_get_option_value( 'buftype', { buf = bufnr, } )
61 dbg.print( 'buftypes to ignore', ignored.buftypes, 'current buftype', buftype )
62 if vim.iter( ignored.buftypes ):find( buftype ) then return end
64 local buffer_path = vim.api.nvim_buf_get_name( bufnr )
64 local buffer_path = vim.api.nvim_buf_get_name( bufnr )
66 debug.print( string.format( 'searching lsp client for: match: %s, buffer: %s, path: %s', match, bufnr, buffer_path ) )
66 dbg.print( string.format( 'searching lsp client for: match: %s, buffer: %s, path: %s', match, bufnr, buffer_path ) )
68 local potential_client_configs = vim.iter( lsp_client_configs )
69 :map( function ( config )
70 vim.validate {
71 ['config'] = { config, 'table', },
72 ['config.name'] = { config.name, 'string', },
73 ['config.filetypes'] = { config.filetypes, { 'string', 'table', }, },
74 ['config.command'] = { config.command, { 'string', 'table', }, },
75 ['config.environment'] = { config.environment, 'table', true, },
76 ['config.root_dir'] = { config.root_dir, 'function', 'string', },
77 ['config.single_file_support'] = { config.single_file_support, 'boolean', true, },
78 ['config.settings'] = { config.settings, 'table', true, },
79 ['config.workspaces'] = { config.workspaces, 'boolean', true, },
80 ['config.before_init'] = { config.before_init, 'function', true, },
81 ['config.init_options'] = { config.init_options, 'table', true, },
82 ['config.capabilities'] = { config.capabilities, 'table', true, },
83 ['config.custom_start'] = { config.custom_start, 'function', true, },
84 }
85 -- normalize scalar values to its vector alternative for easier processing later on
86 -- this mutates the lsp client configs! careful!
87 config.command = type( config.command ) == 'string' and { expand_command( config.command ), } or
88 expand_command( config.command )
89 config.environment = config.environment or {}
90 config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes, } or config.filetypes
91 config.single_file_support = config.single_file_support == nil and false or config.single_file_support
92 config.workspaces = config.workspaces == nil and false or config.workspaces
93 config.capabilities = config.capabilities or {}
94 config.init_options = config.init_options or {}
68 local potential_client_configs = vim.iter( lsp_client_configs )
69 :map( function ( config )
70 vim.validate {
71 ['config'] = { config, 'table', },
72 ['config.name'] = { config.name, 'string', },
73 ['config.filetypes'] = { config.filetypes, { 'string', 'table', }, },
74 ['config.command'] = { config.command, { 'string', 'table', }, },
75 ['config.environment'] = { config.environment, 'table', true, },
76 ['config.root_dir'] = { config.root_dir, 'function', 'string', },
77 ['config.single_file_support'] = { config.single_file_support, 'boolean', true, },
78 ['config.settings'] = { config.settings, 'table', true, },
79 ['config.workspaces'] = { config.workspaces, 'boolean', true, },
80 ['config.before_init'] = { config.before_init, 'function', true, },
81 ['config.init_options'] = { config.init_options, 'table', true, },
82 ['config.capabilities'] = { config.capabilities, 'table', true, },
83 ['config.custom_start'] = { config.custom_start, 'function', true, },
84 }
85 -- normalize scalar values to its vector alternative for easier processing later on
86 -- this mutates the lsp client configs! careful!
87 config.command = type( config.command ) == 'string' and { expand_command( config.command ), } or
88 expand_command( config.command )
89 config.environment = config.environment or {}
90 config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes, } or config.filetypes
91 config.single_file_support = config.single_file_support == nil and false or config.single_file_support
92 config.workspaces = config.workspaces == nil and false or config.workspaces
93 config.capabilities = config.capabilities or {}
94 config.init_options = config.init_options or {}
96 return config
97 end )
98 :filter( function ( config )
99 return vim.iter( config.filetypes ):find( match )
100 end )
101 :totable()
96 return config
97 end )
98 :filter( function ( config )
99 return vim.iter( config.filetypes ):find( match )
100 end )
101 :totable()
103 debug.print( 'POTENTIAL CLIENTS',
104 vim.iter( potential_client_configs ):map( function ( config )
105 return {
106 name = config.name,
107 command =
108 config.command,
109 }
110 end )
111 :totable() )
103 dbg.print( 'POTENTIAL CLIENTS',
104 vim.iter( potential_client_configs ):map( function ( config )
105 return {
106 name = config.name,
107 command =
108 config.command,
109 }
110 end )
111 :totable() )
113 if table.is_empty( potential_client_configs ) then
114 debug.print( 'found no lsp client for', buffer_path )
115 return
116 end
113 if table.is_empty( potential_client_configs ) then
114 dbg.print( 'found no lsp client for', buffer_path )
115 return
116 end
118 --NOTE: this is super kool but has the limitation, that only lsp clients
119 -- configured via my special lsp module are affected.
120 local project_local_lsp_settings = localrc( '.lsp.settings.lua', 'table' ) or {}
118 --NOTE: this is super kool but has the limitation, that only lsp clients
119 -- configured via my special lsp module are affected.
120 local project_local_lsp_settings = localrc( '.lsp.settings.lua', 'table' ) or {}
121 local project_local_workspace_folders = localrc( '.lsp.workspace_folders.lua', 'table' ) or {}
122 for _, config in ipairs( potential_client_configs ) do
123 local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
124 local capabilities = vim.lsp.protocol.make_client_capabilities()
125 capabilities = table.extend( 'force', capabilities, config.capabilities )
123 -- expand relative workspace paths into lsp.workspaceFolders (name + uri)
124 for lsp, folders in pairs( project_local_workspace_folders ) do
125 for idx, path in ipairs( folders ) do
126 local cwd = vim.uv.cwd()
127 local abs_path = vim.fs.normalize( vim.fs.joinpath( cwd, path ) )
127 local settings = config.settings
128 local settings_override = project_local_lsp_settings[config.name]
129 if settings_override then
130 debug.print( 'overriding settings with project local settings', settings, settings_override )
131 settings = vim.tbl_deep_extend( 'force', settings, settings_override )
132 end
129 local exists = vim.uv.fs_stat( abs_path )
130 if not exists or exists.type ~= 'directory' then
131 vim.error( 'the project local workspace folder ' ..
132 abs_path .. ' does not exist or is not a directory.' )
133 end
134 debug.print( 'starting command:', config.command )
135 project_local_workspace_folders[lsp][idx] = { uri = 'file://' .. abs_path, name = path, }
136 end
137 end
136 local start_config = {
137 cmd = config.command,
138 cmd_cwd = root_dir,
139 -- cmd_env = config.environment,
140 detached = false, -- do i want this?
141 root_dir = root_dir,
142 -- workspace_folders = { config.root_dir(buffer_path) }, -- TODO: i think workspaces can only ever be declared per project. i cannot think of a generic way to calculate those, like with root_dir. maybe a toml/ini file in root_dir sets these?
143 capabilities = capabilities,
144 -- handlers = vim.lsp.handlers,
145 settings = settings,
146 -- commands = nil, -- what is this?
147 init_options = config.init_options,
148 name = config.name,
149 -- get_language_id = nil,
150 -- offset_encoding = nil,
151 on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
152 before_init = config.before_init,
153 -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
154 on_exit = function ( code, signal, client_id ) debug.print( 'LSP CLIENT EXIT', code, signal, client_id ) end,
155 on_attach = function ( client, attach_bufnr ) debug.print( 'LSP CLIENT ATTACH', client, attach_bufnr ) end,
156 trace = debug.get() and 'on' or 'off',
157 flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200, },
158 }
139 dbg.print( 'patched project local workspace folders', project_local_workspace_folders )
160 local lsp_starter = config.custom_start or vim.lsp.start
141 for _, config in ipairs( potential_client_configs ) do
142 local path = type( config.command ) == 'table' and config.command[1] or config.command
143 if vim.fn.executable( path ) ~= 1 then
144 vim.notify( 'The LSP ' .. config.name .. ' does not seem to be installed!' )
145 break
146 end
162 debug.print( 'starting lsp', start_config.name, root_dir )
148 local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
149 local capabilities = vim.lsp.protocol.make_client_capabilities()
150 capabilities = table.extend( 'force', capabilities, config.capabilities )
164 lsp_starter( start_config, {
165 bufnr = bufnr,
166 -- TODO: reuse if workspaces
167 -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
168 reuse_client = function ( existing_client, new_config )
169 debug.print(
170 'lsp resuse client',
171 existing_client.name,
172 existing_client.workspace_folders,
173 new_config.name,
174 new_config.root_dir
175 )
152 local settings = config.settings
153 local settings_override = project_local_lsp_settings[config.name]
154 if settings_override then
155 dbg.print( 'overriding settings with project local settings', settings, settings_override )
156 settings = vim.tbl_deep_extend( 'force', settings, settings_override )
157 end
177 --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
178 local same_name = existing_client.name == new_config.name
159 local root_workspace = root_dir and { uri = 'file://' .. root_dir, name = root_dir, } or nil
160 local workspace_folders = root_workspace and { root_workspace, } or nil
161 local workspace_folders_local = project_local_workspace_folders[config.name]
162 if not workspace_folders_local then dbg.print( 'no local workspace folders found for ' .. config.name ) end
163 if workspace_folders_local and config.workspaces then
164 dbg.print( 'setting workspace folders to project local workspace folders', workspace_folders_local )
165 workspace_folders = workspace_folders and
166 vim.tbl_deep_extend( 'force', workspace_folders, workspace_folders_local ) or workspace_folders_local
167 end
180 local new_root_raw = new_config.root_dir or nil
181 local existing_root_raw = existing_client.workspace_folders and #existing_client.workspace_folders >= 1 and
182 existing_client.workspace_folders[1].name or nil
169 dbg.print( 'starting command:', config.command )
184 if not (new_root_raw and existing_root_raw) then return false end
171 local start_config = {
172 cmd = config.command,
173 cmd_cwd = root_dir,
174 -- cmd_env = config.environment,
175 detached = false, -- do i want this?
176 root_dir = root_dir,
177 workspace_folders = workspace_folders,
178 capabilities = capabilities,
179 -- handlers = vim.lsp.handlers,
180 settings = settings,
181 -- commands = nil, -- what is this?
182 init_options = config.init_options,
183 name = config.name,
184 -- get_language_id = nil,
185 -- offset_encoding = nil,
186 on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
187 before_init = config.before_init,
188 -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
189 on_exit = function ( code, signal, client_id ) dbg.print( 'LSP CLIENT EXIT', code, signal, client_id ) end,
190 on_attach = function ( client, attach_bufnr ) dbg.print( 'LSP CLIENT ATTACH', client, attach_bufnr ) end,
191 trace = dbg.get() and 'on' or 'off',
192 flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200, },
193 }
186 local new_root = vim.fs.normalize( new_root_raw )
187 local existing_root = vim.fs.normalize( existing_root_raw )
188 local same_root = new_root == existing_root
195 local lsp_starter = config.custom_start or vim.lsp.start
190 local reuse = same_name and same_root
191 debug.print( 'reusing lsp client?', reuse )
192 return reuse
193 end,
194 } )
197 dbg.print( 'starting lsp', start_config.name, root_dir )
196 debug.print( 'ATTACHING LSP CLIENT', config.name )
197 end
199 lsp_starter( start_config, {
200 bufnr = bufnr,
201 -- TODO: reuse if workspaces
202 -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
203 reuse_client = function ( existing_client, new_config )
204 dbg.print(
205 'lsp reuse client',
206 existing_client.name,
207 existing_client.workspace_folders,
208 new_config.name,
209 new_config.root_dir
210 )
212 --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
213 local same_name = existing_client.name == new_config.name
215 local new_root_raw = new_config.root_dir or nil
216 local existing_root_raw = existing_client.workspace_folders and #existing_client.workspace_folders >= 1 and
217 existing_client.workspace_folders[1].name or nil
219 if not (new_root_raw and existing_root_raw) then return false end
221 local new_root = vim.fs.normalize( new_root_raw )
222 local existing_root = vim.fs.normalize( existing_root_raw )
223 local same_root = new_root == existing_root
225 local reuse = same_name and same_root
226 dbg.print( 'reusing lsp client?', reuse )
227 return reuse
228 end,
229 } )
231 dbg.print( 'ATTACHING LSP CLIENT', config.name )
232 end
198233end
200235local old_formatexpr
204239local keybinds = {}
205240local add = function ( client_id, keybind_remover )
206 vim.validate {
207 client_id = { client_id, 'number', },
208 keybind_remover = { keybind_remover, 'function', },
209 }
210 if not table.contains( keybinds, client_id ) then
211 keybinds[client_id] = {}
212 end
213 table.insert( keybinds[client_id], keybind_remover )
241 vim.validate {
242 client_id = { client_id, 'number', },
243 keybind_remover = { keybind_remover, 'function', },
244 }
245 if not table.contains( keybinds, client_id ) then
246 keybinds[client_id] = {}
247 end
248 table.insert( keybinds[client_id], keybind_remover )
214249end
216251local lsp_attach = function ( args )
217 local bufnr = args.buf
218 local client_id = args.data.client_id
219 local client = vim.lsp.get_client_by_id( client_id )
220 if not client then return end
252 local bufnr = args.buf
253 local client_id = args.data.client_id
254 local client = vim.lsp.get_client_by_id( client_id )
255 if not client then return end
222 debug.print( client.server_capabilities )
257 dbg.print( client.server_capabilities )
224 if client.server_capabilities.definitionProvider then
225 old_tagfunc = vim.bo[bufnr].tagfunc
226 vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
227 end
259 if client.server_capabilities.definitionProvider then
260 old_tagfunc = vim.bo[bufnr].tagfunc
261 vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
262 end
229 if client.server_capabilities.documentFormattingProvider then
230 old_formatexpr = vim.bo[bufnr].formatexpr
231 vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr'
232 end
264 if client.server_capabilities.documentFormattingProvider then
265 old_formatexpr = vim.bo[bufnr].formatexpr
266 vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr'
267 end
234 if client.server_capabilities.completionProvider then
235 old_omnifunc = vim.bo[bufnr].omnifunc
236 vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
237 end
269 if client.server_capabilities.completionProvider then
270 old_omnifunc = vim.bo[bufnr].omnifunc
271 vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
272 end
239 if client.server_capabilities.documentSymbolProvider then
240 local navic_ok, navic = pcall( require, 'nvim-navic' )
241 if navic_ok then
242 navic.attach( client, bufnr )
243 else
244 vim.notify 'nvim-navic not found. could not attach to lsp client.'
245 end
246 local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
247 if navbuddy_ok then
248 navbuddy.attach( client, bufnr )
249 map.normal {
250 description = 'Open overview of symbols in current buffer',
251 category = 'lsp',
252 keys = '<leader>lo',
253 command = function () navbuddy.open( bufnr ) end,
254 buffer = bufnr,
255 }
256 else
257 vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
258 end
259 end
274 if client.server_capabilities.documentSymbolProvider then
275 local navic_ok, navic = pcall( require, 'nvim-navic' )
276 if navic_ok then
277 navic.attach( client, bufnr )
278 else
279 vim.notify 'nvim-navic not found. could not attach to lsp client.'
280 end
281 local navbuddy_ok, navbuddy = pcall( require, 'nvim-navbuddy' )
282 if navbuddy_ok then
283 navbuddy.attach( client, bufnr )
284 map.normal {
285 description = 'Open overview of symbols in current buffer',
286 category = 'lsp',
287 keys = '<leader>lo',
288 command = function () navbuddy.open( bufnr ) end,
289 buffer = bufnr,
290 }
291 else
292 vim.notify 'nvim-navbuddy not found. could not attach to lsp client.'
293 end
294 end
261 if client.server_capabilities.documentHighlightProvider then
262 -- the timer has application lifetime. no need to close
263 local delay = 300
264 local debounced_highlight = defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
265 local debounced_clear = defer.debounce_leading( vim.lsp.buf.clear_references, delay )
296 if client.server_capabilities.documentHighlightProvider then
297 -- the timer has application lifetime. no need to close
298 local delay = 300
299 local debounced_highlight = defer.debounce_leading( vim.lsp.buf.document_highlight, delay )
300 local debounced_clear = defer.debounce_leading( vim.lsp.buf.clear_references, delay )
267 auto 'document_highlight' {
268 {
269 description = 'Highlight symbol under cursor on hold',
270 events = 'CursorHold',
271 buffer = bufnr,
272 command = debounced_highlight,
273 },
274 {
275 description = 'Remove highlight from symbol under cursor on move',
276 events = { 'CursorMoved', 'InsertEnter', },
277 buffer = bufnr,
278 command = debounced_clear,
279 },
280 }
281 end
302 auto 'document_highlight' {
303 {
304 description = 'Highlight symbol under cursor on hold',
305 events = 'CursorHold',
306 buffer = bufnr,
307 command = debounced_highlight,
308 },
309 {
310 description = 'Remove highlight from symbol under cursor on move',
311 events = { 'CursorMoved', 'InsertEnter', },
312 buffer = bufnr,
313 command = debounced_clear,
314 },
315 }
316 end
283 if client.server_capabilities.inlayHintProvider then
284 add( client_id, map.normal {
285 description = 'Toggle inlay hints',
286 category = 'lsp',
287 buffer = bufnr,
288 keys = '<leader>ti',
289 command = function ()
290 vim.lsp.inlay_hint.enable( bufnr, nil )
291 end,
292 } )
293 end
318 if client.server_capabilities.inlayHintProvider then
319 add( client_id, map.normal {
320 description = 'Toggle inlay hints',
321 category = 'lsp',
322 buffer = bufnr,
323 keys = '<leader>ti',
324 command = function ()
325 vim.lsp.inlay_hint.enable( bufnr, nil )
326 end,
327 } )
328 end
295 add( client_id, map.normal {
296 description = 'Show hover documentation above cursor.',
297 category = 'lsp',
298 buffer = bufnr,
299 keys = { 'K', '<leader>lk', },
300 command = vim.lsp.buf.hover,
301 } )
330 add( client_id, map.normal {
331 description = 'Show hover documentation above cursor.',
332 category = 'lsp',
333 buffer = bufnr,
334 keys = { 'K', '<leader>lk', },
335 command = vim.lsp.buf.hover,
336 } )
303 add( client_id, map.normal {
304 description = 'Show signature help under cursor.',
305 category = 'lsp',
306 buffer = bufnr,
307 keys = { 'H', '<leader>ls', },
308 command = vim.lsp.buf.signature_help,
309 } )
338 add( client_id, map.insert {
339 description = 'Show signature help under cursor.',
340 category = 'lsp',
341 buffer = bufnr,
342 keys = { '<C-h>', },
343 command = vim.lsp.buf.signature_help,
344 } )
311 add( client_id, map.normal {
312 description = 'Show available code actions on current line.',
313 category = 'lsp',
314 buffer = bufnr,
315 keys = '<leader>la',
316 command = vim.lsp.buf.code_action,
317 } )
346 add( client_id, map.normal {
347 description = 'Show available code actions on current line.',
348 category = 'lsp',
349 buffer = bufnr,
350 keys = '<leader>la',
351 command = vim.lsp.buf.code_action,
352 } )
319 add( client_id, map.normal {
320 description = 'Goto to definition of symbol under cursor.',
321 category = 'lsp',
322 buffer = bufnr,
323 keys = '<leader>ld',
324 command = vim.lsp.buf.definition,
325 } )
354 add( client_id, map.normal {
355 description = 'Goto to definition of symbol under cursor.',
356 category = 'lsp',
357 buffer = bufnr,
358 keys = '<leader>ld',
359 command = vim.lsp.buf.definition,
360 } )
327 add( client_id, map.normal {
328 description = 'Show implementations of symbol under cursor.',
329 category = 'lsp',
330 buffer = bufnr,
331 keys = '<leader>li',
332 command = vim.lsp.buf.implementation,
333 } )
362 add( client_id, map.normal {
363 description = 'Show implementations of symbol under cursor.',
364 category = 'lsp',
365 buffer = bufnr,
366 keys = '<leader>li',
367 command = vim.lsp.buf.implementation,
368 } )
335 add( client_id, map.normal {
336 description = 'Show incoming calls of symbol under cursor.',
337 category = 'lsp',
338 buffer = bufnr,
339 keys = '<leader>lci',
340 command = vim.lsp.buf.incoming_calls,
341 } )
370 add( client_id, map.normal {
371 description = 'Show incoming calls of symbol under cursor.',
372 category = 'lsp',
373 buffer = bufnr,
374 keys = '<leader>lci',
375 command = vim.lsp.buf.incoming_calls,
376 } )
343 add( client_id, map.normal {
344 description = 'Show outgoing calls of symbol under cursor.',
345 category = 'lsp',
346 buffer = bufnr,
347 keys = '<leader>lco',
348 command = vim.lsp.buf.outgoing_calls,
349 } )
378 add( client_id, map.normal {
379 description = 'Show outgoing calls of symbol under cursor.',
380 category = 'lsp',
381 buffer = bufnr,
382 keys = '<leader>lco',
383 command = vim.lsp.buf.outgoing_calls,
384 } )
351 add( client_id, map.normal {
352 description = 'Show references of symbol under cursor.',
353 category = 'lsp',
354 buffer = bufnr,
355 keys = '<leader>ln',
356 command = vim.lsp.buf.references,
357 } )
386 add( client_id, map.normal {
387 description = 'Show references of symbol under cursor.',
388 category = 'lsp',
389 buffer = bufnr,
390 keys = '<leader>ln',
391 command = vim.lsp.buf.references,
392 } )
359 add( client_id, map.normal {
360 description = 'Rename symbol under cursor.',
361 category = 'lsp',
362 buffer = bufnr,
363 keys = { '<f2>', '<leader>lr', },
364 command = vim.lsp.buf.rename,
365 } )
394 add( client_id, map.normal {
395 description = 'Rename symbol under cursor.',
396 category = 'lsp',
397 buffer = bufnr,
398 keys = { '<f2>', '<leader>lr', },
399 command = vim.lsp.buf.rename,
400 } )
366401end
368403local lsp_detach = function ( args )
369 debug.print( 'DETACH LSP', args )
404 dbg.print( 'DETACH LSP', args )
371 local bufnr = args.buf
372 local client_id = args.data.client_id
373 local client = vim.lsp.get_client_by_id( client_id )
374 if not client then return end
406 local bufnr = args.buf
407 local client_id = args.data.client_id
408 local client = vim.lsp.get_client_by_id( client_id )
409 if not client then return end
376 if client.server_capabilities.definitionProvider then
377 vim.bo[bufnr].tagfunc = old_tagfunc
378 end
411 if client.server_capabilities.definitionProvider then
412 vim.bo[bufnr].tagfunc = old_tagfunc
413 end
380 if client.server_capabilities.documentFormattingProvider then
381 vim.bo[bufnr].formatexpr = old_formatexpr
382 end
415 if client.server_capabilities.documentFormattingProvider then
416 vim.bo[bufnr].formatexpr = old_formatexpr
417 end
384 if client.server_capabilities.completionProvider then
385 vim.bo[bufnr].omnifunc = old_omnifunc
386 end
419 if client.server_capabilities.completionProvider then
420 vim.bo[bufnr].omnifunc = old_omnifunc
421 end
388 if table.contains( keybinds, client_id ) then
389 for _, keybind_delete in ipairs( keybinds[client_id] ) do
390 keybind_delete()
391 end
392 end
423 if table.contains( keybinds, client_id ) then
424 for _, keybind_delete in ipairs( keybinds[client_id] ) do
425 keybind_delete()
426 end
427 end
393428end
395430auto 'lsp' {
396 {
397 description = 'Start or reuse LSP client',
398 events = 'FileType',
399 command = lsp_start,
400 },
401 {
402 description = 'Hook: LSP client attached to buffer',
403 events = 'LspAttach',
404 command = lsp_attach,
405 },
406 {
407 description = 'Hook: LSP client detached from buffer',
408 events = 'LspDetach',
409 command = lsp_detach,
410 },
411 {
412 description = 'Semantic Tokens from the LSP',
413 events = 'LspTokenUpdate',
414 command = token_update,
415 },
431 {
432 description = 'Start or reuse LSP client',
433 events = 'FileType',
434 command = lsp_start,
435 },
436 {
437 description = 'Hook: LSP client attached to buffer',
438 events = 'LspAttach',
439 command = lsp_attach,
440 },
441 {
442 description = 'Hook: LSP client detached from buffer',
443 events = 'LspDetach',
444 command = lsp_detach,
445 },
446 {
447 description = 'Semantic Tokens from the LSP',
448 events = 'LspTokenUpdate',
449 command = token_update,
450 },
418453local lsp_info = function ( command )
419 local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
420 local active_clients = vim.lsp.get_clients( all_or_current )
454 local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
455 local active_clients = vim.lsp.get_clients( all_or_current )
422 local infos = vim.iter( active_clients )
423 :map( function ( client )
424 local name = client.name
425 local config = vim.iter( lsp_client_configs ):find( function ( config ) return config.name == name end )
426 assert( config, ('How did we not find a config for %s ?!?!'):format( name ) )
457 local infos = vim.iter( active_clients )
458 :map( function ( client )
459 local name = client.name
460 local config = vim.iter( lsp_client_configs ):find( function ( config ) return config.name == name end )
461 assert( config, ('How did we not find a config for %s ?!?!'):format( name ) )
428 local full_cmd = table.deep_copy( client.config.cmd )
429 full_cmd[1] = vim.fn.exepath( full_cmd[1] )
430 local basic = {
431 id = client.id,
432 name = name,
433 cmd = table.concat( full_cmd, ' ' ),
434 workspace_folders = vim.iter( client.workspace_folders ):map( function ( w ) return vim.fs.normalize( w.name ) end )
435 :totable(),
436 filetypes = table.concat( config.filetypes, ', ' ),
437 single_file_support = config.single_file_support,
438 workspaces = config.workspaces,
439 }
440 return basic
441 end )
442 :totable()
463 local full_cmd = table.deep_copy( client.config.cmd )
464 full_cmd[1] = vim.fn.exepath( full_cmd[1] )
465 local basic = {
466 id = client.id,
467 name = name,
468 cmd = table.concat( full_cmd, ' ' ),
469 workspace_folders = vim.iter( client.workspace_folders ):map( function ( w ) return vim.fs.normalize( w.name ) end )
470 :totable(),
471 filetypes = table.concat( config.filetypes, ', ' ),
472 single_file_support = config.single_file_support,
473 workspaces = config.workspaces,
474 }
475 return basic
476 end )
477 :totable()
444 ui.show_tree( infos )
479 ui.show_tree( infos )
445480end
447482local lsp_info_extended = function ( command )
448 local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
449 local active_clients = vim.lsp.get_clients( all_or_current )
450 ui.show_tree( active_clients )
483 local all_or_current = command.args and command.args == 'all' and {} or { bufnr = 0, }
484 local active_clients = vim.lsp.get_clients( all_or_current )
485 ui.show_tree( active_clients )
451486end
453488user_command.LspInfo
454489'Shows basic information about running LSP clients.'
455 { nargs = '?', complete = function () return { 'all', } end, } (
456 lsp_info
457 )
490 { nargs = '?', complete = function () return { 'all', } end, } (
491 lsp_info
492 )
459494user_command.LspInfoExtended
460495'Shows detailed information about running LSP clients.'
461 { nargs = '?', complete = function () return { 'all', } end, } (
462 lsp_info_extended
463 )
496 { nargs = '?', complete = function () return { 'all', } end, } (
497 lsp_info_extended
498 )
465500-- TODO: LspStart
466501-- TODO: LspStop
467502-- TODO: LspRestart ? Maybe good after changing project local settings?
469504local completion_icons = {
470 Class = icon.class,
471 Color = icon.color,
472 Constant = icon.constant,
473 Constructor = icon.constructor,
474 Enum = icon.enum,
475 EnumMember = icon.enum_member,
476 Field = icon.field,
477 File = icon.file,
478 Folder = icon.folder,
479 Function = icon['function'],
480 Interface = icon.interface,
481 Keyword = icon.keyword,
482 Method = icon.method,
483 Module = icon.module,
484 Property = icon.property,
485 Snippet = icon.snippet,
486 Struct = icon.struct,
487 Text = icon.text,
488 Unit = icon.unit,
489 Value = icon.value,
490 Variable = icon.variable,
505 Class = icon.class,
506 Color = icon.color,
507 Constant = icon.constant,
508 Constructor = icon.constructor,
509 Enum = icon.enum,
510 EnumMember = icon.enum_member,
511 Field = icon.field,
512 File = icon.file,
513 Folder = icon.folder,
514 Function = icon['function'],
515 Interface = icon.interface,
516 Keyword = icon.keyword,
517 Method = icon.method,
518 Module = icon.module,
519 Property = icon.property,
520 Snippet = icon.snippet,
521 Struct = icon.struct,
522 Text = icon.text,
523 Unit = icon.unit,
524 Value = icon.value,
525 Variable = icon.variable,
493528local completion_kinds = vim.lsp.protocol.CompletionItemKind
494529for i, kind in ipairs( completion_kinds ) do
495 completion_kinds[i] = completion_icons[kind] or kind
530 completion_kinds[i] = completion_icons[kind] or kind
496531end
498533return setmetatable( _, {} )

neovim/lua/bugabinga/options/behaviour.lua

Modified

+2 / −1 text lines

2828-- insert whitespace type based on whitespace on previous line
2929vim.opt.smarttab = true
31vim.opt.wrap = false
31vim.opt.wrap = true
32vim.opt.breakindent = true
3334-- do not keep distance to borders while scrolling
3435vim.opt.scrolloff = 0

neovim/lua/bugabinga/options/ui.lua

Modified

+60 / −71 text lines

33local ignored = require 'std.ignored'
55auto 'highlight_yanked_text' {
6 description = 'briefly highlight yanked text',
7 events = 'TextYankPost',
8 pattern = '*',
9 command = function () vim.highlight.on_yank() end,
6 description = 'briefly highlight yanked text',
7 events = 'TextYankPost',
8 pattern = '*',
9 command = function () vim.highlight.on_yank() end,
1212auto 'disable_columns_in_special_buffers' {
13 description = 'Hide columns in buffers, that do not show source code.',
14 events = { 'FileType', },
15 pattern = ignored.filetypes,
16 command = function ()
17 vim.opt_local.colorcolumn = {}
18 vim.opt_local.signcolumn = 'no'
19 vim.opt_local.foldcolumn = '0'
20 vim.opt_local.number = false
21 end,
13 description = 'Hide columns in buffers, that do not show source code.',
14 events = { 'FileType', },
15 pattern = ignored.filetypes,
16 command = function ()
17 vim.opt_local.colorcolumn = {}
18 vim.opt_local.signcolumn = 'no'
19 vim.opt_local.foldcolumn = '0'
20 vim.opt_local.number = false
21 end,
2424-- show trailing whitespace
2525vim.opt.list = true
2626vim.opt.listchars = {
27 -- space = icon.space,
28 -- eol = icon.eol,
29 -- tab = icon.tab .. icon.middle_ellipsis,
30 tab = ' ',
31 trail = icon.trail,
32 extends = icon.extends,
33 precedes = icon.precedes,
34 nbsp = icon.nbsp,
27 -- space = icon.space,
28 -- eol = icon.eol,
29 -- tab = icon.tab .. icon.middle_ellipsis,
30 tab = ' ',
31 trail = icon.trail,
32 extends = icon.extends,
33 precedes = icon.precedes,
34 nbsp = icon.nbsp,
3737-- force English messages
5555-- hide weird symbol at end of buffer
5656vim.opt.fillchars = {
57 eob = ' ',
58 lastline = ' ',
59 diff = '╱',
60 wbr = ' ',
57 eob = ' ',
58 lastline = ' ',
59 diff = '╱',
60 wbr = ' ',
62 horiz = '─',
63 horizup = '┴',
64 horizdown = '┬',
65 vert = '│',
66 vertleft = '┤',
67 vertright = '├',
68 verthoriz = '┼',
62 horiz = '─',
63 horizup = '┴',
64 horizdown = '┬',
65 vert = '│',
66 vertleft = '┤',
67 vertright = '├',
68 verthoriz = '┼',
7171-- better have no syntax highlighting than regex based, treesitter will take over later
7272vim.opt.syntax = 'off'
7474-- hide output of insert completion popup in status
75vim.opt.shortmess:append 'c'
75-- vim.opt.shortmess:append 'c'
7676-- hide vim intro screen
7777vim.opt.shortmess:append 'I'
7878-- truncate messages at end
79vim.opt.shortmess:append 't'
79-- vim.opt.shortmess:append 't'
8181-- show cmd window to prevent jitter UI
8282vim.opt.cmdheight = 1
101101vim.opt.winblend = 0
103103-- use this in various places for consistent border style
104vim.g.border_style = {
105 style = {
106 top_left = '╭',
107 top = '─',
108 top_right = '╮',
109 left = '│',
110 right = '│',
111 bottom_left = '╰',
112 bottom = '─',
113 bottom_right = '╯',
114 },
115}
104vim.g.border_style = 'solid'
117106-- hide the mode indicator in status
118107vim.opt.showmode = false
123112local is_tty = os.getenv 'XDG_SESSION_TYPE' == 'tty' and os.getenv 'SSH_TTY' == ''
124113if is_tty then
125 vim.opt.termguicolors = false
126 vim.g.nerdfont = false
127 vim.opt.lazyredraw = true
114 vim.opt.termguicolors = false
115 vim.g.nerdfont = false
116 vim.opt.lazyredraw = true
128117else
129 vim.opt.termguicolors = true
130 vim.g.nerdfont = true
131 vim.opt.lazyredraw = false
118 vim.opt.termguicolors = true
119 vim.g.nerdfont = true
120 vim.opt.lazyredraw = false
132121end
134123-- scroll by screen lines if buffer is wrapped
146135-- neovide only options
147136if vim.g.neovide then
148 -- vim.g.neovide_floating_blur_amount_x = 12.0
149 -- vim.g.neovide_floating_blur_amount_y = 12.0
150 -- vim.g.neovide_scroll_animation_length = 0.69
151 -- vim.g.neovide_fullscreen = true
152 vim.g.neovide_remember_window_size = true
153 vim.g.neovide_profiler = false
154 -- vim.g.neovide_cursor_animation_length = 0.42
155 -- vim.g.neovide_cursor_trail_length = 0.42
156 vim.g.neovide_cursor_vfx_mode = 'railgun'
157 -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
158 vim.g.neovide_cursor_antialiasing = true
159 vim.g.neovide_padding_top = 0
160 vim.g.neovide_padding_bottom = 0
161 vim.g.neovide_padding_right = 0
162 vim.g.neovide_padding_left = 0
163 vim.g.neovide_hide_mouse_when_typing = true
164 vim.g.neovide_theme = 'auto'
165 vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
166 vim.g.neovide_refresh_rate_idle = 5
137 -- vim.g.neovide_floating_blur_amount_x = 12.0
138 -- vim.g.neovide_floating_blur_amount_y = 12.0
139 -- vim.g.neovide_scroll_animation_length = 0.69
140 -- vim.g.neovide_fullscreen = true
141 vim.g.neovide_remember_window_size = true
142 vim.g.neovide_profiler = false
143 -- vim.g.neovide_cursor_animation_length = 0.42
144 -- vim.g.neovide_cursor_trail_length = 0.42
145 vim.g.neovide_cursor_vfx_mode = 'railgun'
146 -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
147 vim.g.neovide_cursor_antialiasing = true
148 vim.g.neovide_padding_top = 0
149 vim.g.neovide_padding_bottom = 0
150 vim.g.neovide_padding_right = 0
151 vim.g.neovide_padding_left = 0
152 vim.g.neovide_hide_mouse_when_typing = true
153 vim.g.neovide_theme = 'auto'
154 vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
155 vim.g.neovide_refresh_rate_idle = 5
167156end

neovim/lua/bugabinga/plugins/conform.lua

Added
new file mode 100644

+54 / −0 text lines

1local debug = require 'std.dbg'
2local map = require 'std.map'
3local user_command = require 'std.user_command'
4
5local format = function ()
6 prequire 'conform'.format( { async = false, lsp_fallback = true, }, function ( err )
7 if err and debug.get() then
8 vim.print( 'Format failed', err )
9 end
10 end )
11end
13map.N {
14 description = 'Format buffer',
15 category = 'format',
16 keys = '=',
17 command = format,
18}
20user_command.Format
21'Format the current buffer' (
22 format
23 )
25return {
26 'stevearc/conform.nvim',
27 cmd = { 'ConformInfo', },
28 opts = {
29 formatters_by_ft = {
30 -- https://github.com/razziel89/mdslw/issues/14
31 markdown = { 'mdslw', },
32 -- lua = { "stylua" },
33 toml = { 'taplo', },
34 sh = { 'shfmt', },
35 just = { 'just', },
36 zig = { 'zigfmt', },
37 -- Use the "*" file type to run formatters on all file types.
38 ['*'] = { 'injected', 'typos', },
39 -- Use the "_" file type to run formatters on file types that don't
40 -- have other formatters configured.
41 ['_'] = { 'trim_whitespace', 'trim_newlines', },
42 },
43 formatters = {
44 mdslw = {
45 -- remove `:` from the default set of end markers
46 -- prepend_args = { '--end-markers', '?!.', },
47 },
48 },
49 log_level = debug.get() and vim.log.levels.TRACE or vim.log.levels.INFO,
50 },
51 init = function ()
52 vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
53 end,
54}

neovim/lua/bugabinga/plugins/format.lua

Deleted
deleted file mode 100644

+0 / −54 text lines

1local debug = require 'std.dbg'
2local map = require 'std.map'
3local user_command = require 'std.user_command'
4
5local format = function ()
6 prequire 'conform'.format( { async = false, lsp_fallback = true, }, function ( err )
7 if err and debug.get() then
8 vim.print( 'Format failed', err )
9 end
10 end )
11end
13map.N {
14 description = 'Format buffer',
15 category = 'format',
16 keys = '=',
17 command = format,
18}
20user_command.Format
21'Format the current buffer' (
22 format
23 )
25return {
26 'stevearc/conform.nvim',
27 cmd = { 'ConformInfo', },
28 opts = {
29 formatters_by_ft = {
30 -- https://github.com/razziel89/mdslw/issues/14
31 markdown = { 'mdslw', },
32 -- lua = { "stylua" },
33 toml = { 'taplo', },
34 sh = { 'shfmt', },
35 just = { 'just', },
36 zig = { 'zigfmt', },
37 -- Use the "*" file type to run formatters on all file types.
38 ['*'] = { 'injected', 'typos', },
39 -- Use the "_" file type to run formatters on file types that don't
40 -- have other formatters configured.
41 ['_'] = { 'trim_whitespace', 'trim_newlines', },
42 },
43 formatters = {
44 mdslw = {
45 -- remove `:` from the default set of end markers
46 -- prepend_args = { '--end-markers', '?!.', },
47 },
48 },
49 log_level = debug.get() and vim.log.levels.TRACE or vim.log.levels.INFO,
50 },
51 init = function ()
52 vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
53 end,
54}

neovim/lua/bugabinga/plugins/jdtls.lua

Added
new file mode 100644

+1 / −0 text lines

1return { 'bugabinga/nvim-jdtls', }

neovim/lua/bugabinga/plugins/luasnip.lua

Added
new file mode 100644

+114 / −0 text lines

1--FIXME: own this
2return {
3 'L3MON4D3/LuaSnip',
4 dependencies = {
5 'stevearc/vim-vscode-snippets',
6 },
7 config = function ()
8 local luasnip = require 'luasnip'
9 local has_vim_snippet, snippet = pcall( require, 'vim.snippet' )
10 require 'luasnip.loaders.from_vscode'.lazy_load()
11 vim.keymap.set( 's', '<Tab>', '<Plug>luasnip-jump-next' )
12 vim.keymap.set( 's', '<C-h>', '<Plug>luasnip-jump-prev' )
13 vim.keymap.set( 's', '<C-l>', '<Plug>luasnip-jump-next' )
14 vim.keymap.set( { 'i', 's', }, '<C-k>', function () pcall( luasnip.change_choice, -1 ) end )
15 vim.keymap.set( { 'i', 's', }, '<C-j>', function () pcall( luasnip.change_choice, 1 ) end )
17 local aug = vim.api.nvim_create_augroup( 'ClearLuasnipSession', { clear = true, } )
18 -- Can't use InsertLeave here because that fires when we go to select mode
19 vim.api.nvim_create_autocmd( 'CursorHold', {
20 desc = 'Deactivate snippet after leaving insert/select mode',
21 pattern = '*',
22 group = aug,
23 callback = function ()
24 vim.cmd.LuaSnipUnlinkCurrent { mods = { emsg_silent = true, }, }
25 if has_vim_snippet then
26 snippet.exit()
27 end
28 end,
29 } )
31 vim.keymap.set( 'i', '<C-h>', function ()
32 if luasnip.get_active_snip() then
33 luasnip.jump( -1 )
34 elseif has_vim_snippet and snippet.active() then
35 snippet.jump( -1 )
36 else
37 local cur = vim.api.nvim_win_get_cursor( 0 )
38 pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] - 1, } )
39 end
40 end )
41 vim.keymap.set( 'i', '<C-l>', function ()
42 if luasnip.get_active_snip() then
43 luasnip.jump( 1 )
44 elseif has_vim_snippet and snippet.active() then
45 snippet.jump( 1 )
46 else
47 local cur = vim.api.nvim_win_get_cursor( 0 )
48 pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] + 1, } )
49 end
50 end )
52 -- Required to support nested placeholders
53 -- From https://github.com/L3MON4D3/LuaSnip/wiki/Nice-Configs#imitate-vscodes-behaviour-for-nested-placeholders
54 local util = require 'luasnip.util.util'
56 luasnip.config.setup {
57 store_selection_keys = '<Tab>',
58 updateevents = 'TextChanged,TextChangedI',
59 parser_nested_assembler = function ( _, snippet )
60 local select = function ( snip, no_move )
61 snip.parent:enter_node( snip.indx )
62 -- upon deletion, extmarks of inner nodes should shift to end of
63 -- placeholder-text.
64 for _, node in ipairs( snip.nodes ) do
65 node:set_mark_rgrav( true, true )
66 end
68 -- SELECT all text inside the snippet.
69 if not no_move then
70 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( '<Esc>', true, false, true ), 'n', true )
71 local pos_begin, pos_end = snip.mark:pos_begin_end()
72 util.normal_move_on( pos_begin )
73 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'v', true, false, true ), 'n', true )
74 util.normal_move_before( pos_end )
75 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'o<C-G>', true, false, true ), 'n', true )
76 end
77 end
78 function snippet:jump_into( dir, no_move )
79 if self.active then
80 -- inside snippet, but not selected.
81 if dir == 1 then
82 self:input_leave()
83 return self.next:jump_into( dir, no_move )
84 else
85 select( self, no_move )
86 return self
87 end
88 else
89 -- jumping in from outside snippet.
90 self:input_enter()
91 if dir == 1 then
92 select( self, no_move )
93 return self
94 else
95 return self.inner_last:jump_into( dir, no_move )
96 end
97 end
98 end
100 -- this is called only if the snippet is currently selected.
101 function snippet:jump_from( dir, no_move )
102 if dir == 1 then
103 return self.inner_first:jump_into( dir, no_move )
104 else
105 self:input_leave()
106 return self.prev:jump_into( dir, no_move )
107 end
108 end
110 return snippet
111 end,
112 }
113 end,
114}

neovim/lua/bugabinga/plugins/navbuddy.lua

Added
new file mode 100644

+14 / −0 text lines

1local map = require 'std.map'
2
3return {
4 'SmiteshP/nvim-navbuddy',
5 dependencies = {
6 'SmiteshP/nvim-navic',
7 'MunifTanjim/nui.nvim',
8 },
9 opts = {
10 window = {
11 border = vim.g.border_style,
12 },
13 },
14}

neovim/lua/bugabinga/plugins/neogen.lua

Modified

+10 / −10 text lines

11local map = require 'std.map'
33map.normal {
4 description = 'Generate doc comment for outer element',
5 category = 'editing',
4 description = 'Doc Comment',
5 category = 'generate',
66 keys = '<leader>gdd',
77 command = function () require 'neogen'.generate() end,
88}
1010map.normal {
11 name = 'Generate Doc Comment for Function',
12 category = 'editing',
11 name = 'Doc Comment for Function',
12 category = 'generate',
1313 keys = '<leader>gdm',
1414 command = function () require 'neogen'.generate { type = 'func', } end,
1717map.normal {
18 description = 'Generate Doc Comment for File',
19 category = 'editing',
18 description = 'Doc Comment for File',
19 category = 'generate',
2020 keys = '<leader>gdf',
2121 command = function () require 'neogen'.generate { type = 'file', } end,
2424map.normal {
25 description = 'Generate Doc Comment for Class',
26 category = 'editing',
25 description = 'Doc Comment for Class',
26 category = 'generate',
2727 keys = '<leader>gdc',
2828 command = function () require 'neogen'.generate { type = 'class', } end,
3131map.normal {
32 description = 'Generate Doc Comment for Type',
33 category = 'editing',
32 description = 'Doc Comment for Type',
33 category = 'generate',
3434 keys = '<leader>gdt',
3535 command = function () require 'neogen'.generate { type = 'type', } end,

neovim/lua/bugabinga/plugins/nvim-jdtls.lua

Deleted
deleted file mode 100644

+0 / −1 text lines

1return { 'bugabinga/nvim-jdtls', }

neovim/lua/bugabinga/plugins/outline.lua

Deleted
deleted file mode 100644

+0 / −14 text lines

1local map = require 'std.map'
2
3return {
4 'SmiteshP/nvim-navbuddy',
5 dependencies = {
6 'SmiteshP/nvim-navic',
7 'MunifTanjim/nui.nvim',
8 },
9 opts = {
10 window = {
11 border = vim.g.border_style,
12 },
13 },
14}

neovim/lua/bugabinga/plugins/overseer.lua

Added
new file mode 100644

+162 / −0 text lines

1local map = require 'std.map'
2local user_command = require 'std.user_command'
3
4map.normal {
5 description = 'Toggle task view',
6 category = 'tasks',
7 keys = '<leader>99',
8 command = function () prequire 'overseer'.toggle { enter = true, direction = 'right', } end,
9}
11map.normal {
12 description = 'Run task',
13 category = 'tasks',
14 keys = '<leader>9r',
15 command = function () prequire 'overseer'._run_template() end,
16}
18map.normal {
19 description = 'Run any command as task',
20 category = 'tasks',
21 keys = '<leader>9c',
22 command = function () prequire 'overseer'._run_command() end,
23}
25map.normal {
26 description = 'Load task bundle',
27 category = 'tasks',
28 keys = '<leader>9r',
29 command = function () prequire 'overseer'._load_bundle() end,
30}
32map.normal {
33 description = 'Run an action on the most recent task, or the task under the cursor',
34 category = 'tasks',
35 keys = '<leader>9d',
36 command = function () prequire 'overseer'._quick_action() end,
37}
39map.normal {
40 description = 'Select a task to run an action on',
41 category = 'tasks',
42 keys = '<leader>9s',
43 command = function () prequire 'overseer'._task_action() end,
44}
46map.normal {
47 description = 'Display diagnostic information about overseer',
48 category = 'tasks',
49 keys = '<leader>9i',
50 command = function () prequire 'overseer'._info() end,
51}
53user_command.OverseerDebugParser
54'Open a tab with windows laid out for debugging a parser' (
55 function ()
56 prequire 'overseer'.debug_parser()
57 end
58 )
60user_command.Grep
61'Run your grepprg as an Overseer task'
62 { nargs = '*', bang = true, bar = true, complete = 'file', } (
63 function ( params )
64 local args = vim.fn.expandcmd( params.args )
65 -- Insert args at the '$*' in the grepprg
66 local cmd, num_subs = vim.o.grepprg:gsub( '%$%*', args )
67 if num_subs == 0 then
68 cmd = cmd .. ' ' .. args
69 end
70 local cwd
71 prequire( 'oil', function ( oil )
72 cwd = oil.get_current_dir()
73 end )
74 local task = prequire 'overseer'.new_task {
75 cmd = cmd,
76 cwd = cwd,
77 name = 'grep ' .. args,
78 components = {
79 {
80 'on_output_quickfix',
81 errorformat = vim.o.grepformat,
82 open = not params.bang,
83 open_height = 8,
84 items_only = true,
85 },
86 -- We don't care to keep this around as long as most tasks
87 { 'on_complete_dispose', timeout = 30, },
88 'default',
89 },
90 }
91 task:start()
92 end
93 )
95user_command.Make
96'Run your makeprg as an Overseer task'
97 { nargs = '*', bang = true, } (
98 function ( params )
99 -- Insert args at the '$*' in the makeprg
100 local cmd, num_subs = vim.o.makeprg:gsub( '%$%*', params.args )
101 if num_subs == 0 then
102 cmd = cmd .. ' ' .. params.args
103 end
104 local task = prequire 'overseer'.new_task {
105 cmd = vim.fn.expandcmd( cmd ),
106 components = {
107 { 'on_output_quickfix', open = not params.bang, open_height = 8, },
108 'unique',
109 'default',
110 },
111 }
112 task:start()
113 end
114 )
116return {
117 {
118 'stevearc/resession.nvim',
119 lazy = true,
120 opts = {
121 extensions = {
122 overseer = {
123 status = { 'RUNNING', },
124 },
125 },
126 },
127 },
128 {
129 'stevearc/overseer.nvim',
130 opts = {
131 strategy = { 'jobstart', },
132 dap = false,
133 log = {
134 {
135 type = 'echo',
136 level = vim.log.levels.WARN,
137 },
138 {
139 type = 'file',
140 filename = 'overseer.log',
141 level = vim.log.levels.DEBUG,
142 },
143 },
144 component_aliases = {
145 default = {
146 {
147 'display_duration',
148 detail_level = 2,
149 },
150 'on_output_summarize',
151 'on_exit_set_status',
152 { 'on_complete_notify', system = 'unfocused', },
153 'on_complete_dispose',
154 },
155 default_neotest = {
156 'unique',
157 { 'on_complete_notify', system = 'unfocused', on_change = true, },
158 'default',
159 },
160 },
161 },
162 }, }

neovim/lua/bugabinga/plugins/qf_helper.lua

Added
new file mode 100644

+45 / −0 text lines

1local map = require 'std.map'
2
3map.normal {
4 description = 'Grep search for word under cursor',
5 category = 'search',
6 keys = 'gw',
7 command = '<cmd>cclose <bar> Grep <cword><cr>',
8}
9
10map.normal {
11 description = 'Goto next quickfix item',
12 category = 'navigation',
13 keys = ']q',
14 command = '<cmd>QNext<cr>',
15}
17map.normal {
18 description = 'Goto previous quickfix item',
19 category = 'navigation',
20 keys = '[q',
21 command = '<cmd>QPrev<cr>',
22}
24map.normal {
25 description = 'Toggle open quickfix window',
26 category = 'navigation',
27 keys = '<leader>Q',
28 command = '<cmd>QFToggle!<CR>',
29}
31map.normal {
32 description = 'Toggle open loclist window',
33 category = 'navigation',
34 keys = '<leader>L',
35 command = '<cmd>LLToggle!<CR>',
36}
38return {
39 'stevearc/qf_helper.nvim',
40 ft = 'qf',
41 cmd = { 'QNext', 'QPrev', 'QFToggle', 'QFOpen', 'LLToggle', },
42 opts = {
43 prefer_loclist = false,
44 },
45}

neovim/lua/bugabinga/plugins/quickfix.lua

Deleted
deleted file mode 100644

+0 / −45 text lines

1local map = require 'std.map'
2
3map.normal {
4 description = 'Grep search for word under cursor',
5 category = 'search',
6 keys = 'gw',
7 command = '<cmd>cclose <bar> Grep <cword><cr>',
8}
9
10map.normal {
11 description = 'Goto next quickfix item',
12 category = 'navigation',
13 keys = ']q',
14 command = '<cmd>QNext<cr>',
15}
17map.normal {
18 description = 'Goto previous quickfix item',
19 category = 'navigation',
20 keys = '[q',
21 command = '<cmd>QPrev<cr>',
22}
24map.normal {
25 description = 'Toggle open quickfix window',
26 category = 'navigation',
27 keys = '<leader>Q',
28 command = '<cmd>QFToggle!<CR>',
29}
31map.normal {
32 description = 'Toggle open loclist window',
33 category = 'navigation',
34 keys = '<leader>L',
35 command = '<cmd>LLToggle!<CR>',
36}
38return {
39 'stevearc/qf_helper.nvim',
40 ft = 'qf',
41 cmd = { 'QNext', 'QPrev', 'QFToggle', 'QFOpen', 'LLToggle', },
42 opts = {
43 prefer_loclist = false,
44 },
45}

neovim/lua/bugabinga/plugins/snippets.lua

Deleted
deleted file mode 100644

+0 / −114 text lines

1--FIXME: own this
2return {
3 'L3MON4D3/LuaSnip',
4 dependencies = {
5 'stevearc/vim-vscode-snippets',
6 },
7 config = function ()
8 local luasnip = require 'luasnip'
9 local has_vim_snippet, snippet = pcall( require, 'vim.snippet' )
10 require 'luasnip.loaders.from_vscode'.lazy_load()
11 vim.keymap.set( 's', '<Tab>', '<Plug>luasnip-jump-next' )
12 vim.keymap.set( 's', '<C-h>', '<Plug>luasnip-jump-prev' )
13 vim.keymap.set( 's', '<C-l>', '<Plug>luasnip-jump-next' )
14 vim.keymap.set( { 'i', 's', }, '<C-k>', function () pcall( luasnip.change_choice, -1 ) end )
15 vim.keymap.set( { 'i', 's', }, '<C-j>', function () pcall( luasnip.change_choice, 1 ) end )
17 local aug = vim.api.nvim_create_augroup( 'ClearLuasnipSession', { clear = true, } )
18 -- Can't use InsertLeave here because that fires when we go to select mode
19 vim.api.nvim_create_autocmd( 'CursorHold', {
20 desc = 'Deactivate snippet after leaving insert/select mode',
21 pattern = '*',
22 group = aug,
23 callback = function ()
24 vim.cmd.LuaSnipUnlinkCurrent { mods = { emsg_silent = true, }, }
25 if has_vim_snippet then
26 snippet.exit()
27 end
28 end,
29 } )
31 vim.keymap.set( 'i', '<C-h>', function ()
32 if luasnip.get_active_snip() then
33 luasnip.jump( -1 )
34 elseif has_vim_snippet and snippet.active() then
35 snippet.jump( -1 )
36 else
37 local cur = vim.api.nvim_win_get_cursor( 0 )
38 pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] - 1, } )
39 end
40 end )
41 vim.keymap.set( 'i', '<C-l>', function ()
42 if luasnip.get_active_snip() then
43 luasnip.jump( 1 )
44 elseif has_vim_snippet and snippet.active() then
45 snippet.jump( 1 )
46 else
47 local cur = vim.api.nvim_win_get_cursor( 0 )
48 pcall( vim.api.nvim_win_set_cursor, 0, { cur[1], cur[2] + 1, } )
49 end
50 end )
52 -- Required to support nested placeholders
53 -- From https://github.com/L3MON4D3/LuaSnip/wiki/Nice-Configs#imitate-vscodes-behaviour-for-nested-placeholders
54 local util = require 'luasnip.util.util'
56 luasnip.config.setup {
57 store_selection_keys = '<Tab>',
58 updateevents = 'TextChanged,TextChangedI',
59 parser_nested_assembler = function ( _, snippet )
60 local select = function ( snip, no_move )
61 snip.parent:enter_node( snip.indx )
62 -- upon deletion, extmarks of inner nodes should shift to end of
63 -- placeholder-text.
64 for _, node in ipairs( snip.nodes ) do
65 node:set_mark_rgrav( true, true )
66 end
68 -- SELECT all text inside the snippet.
69 if not no_move then
70 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( '<Esc>', true, false, true ), 'n', true )
71 local pos_begin, pos_end = snip.mark:pos_begin_end()
72 util.normal_move_on( pos_begin )
73 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'v', true, false, true ), 'n', true )
74 util.normal_move_before( pos_end )
75 vim.api.nvim_feedkeys( vim.api.nvim_replace_termcodes( 'o<C-G>', true, false, true ), 'n', true )
76 end
77 end
78 function snippet:jump_into( dir, no_move )
79 if self.active then
80 -- inside snippet, but not selected.
81 if dir == 1 then
82 self:input_leave()
83 return self.next:jump_into( dir, no_move )
84 else
85 select( self, no_move )
86 return self
87 end
88 else
89 -- jumping in from outside snippet.
90 self:input_enter()
91 if dir == 1 then
92 select( self, no_move )
93 return self
94 else
95 return self.inner_last:jump_into( dir, no_move )
96 end
97 end
98 end
100 -- this is called only if the snippet is currently selected.
101 function snippet:jump_from( dir, no_move )
102 if dir == 1 then
103 return self.inner_first:jump_into( dir, no_move )
104 else
105 self:input_leave()
106 return self.prev:jump_into( dir, no_move )
107 end
108 end
110 return snippet
111 end,
112 }
113 end,
114}

neovim/lua/bugabinga/plugins/spectre.lua

Modified

+4 / −4 text lines

99 description = 'Search and replace',
1010 category = 'search',
1111 keys = '<leader>rs',
12 command = function () spectre.open() end,
12 command = function () require 'spectre'.open() end,
1515map.normal {
1616 description = 'Search current word',
1717 category = 'search',
1818 keys = '<leader>rw',
19 command = function () spectre.open_visual { select_word = true, } end,
19 command = function () require 'spectre'.open_visual { select_word = true, } end,
2222map.visual {
2323 description = 'Search current word',
2424 category = 'search',
2525 keys = '<leader>rw',
26 command = function () spectre.open_visual() end,
26 command = function () require 'spectre'.open_visual() end,
2929map.normal {
3030 description = 'Search on current file',
3131 category = 'search',
3232 keys = '<leader>rf',
33 command = function () spectre.open_file_search { select_word = true, } end,
33 command = function () require 'spectre'.open_file_search { select_word = true, } end,
3636return {

neovim/lua/bugabinga/plugins/tasks.lua

Deleted
deleted file mode 100644

+0 / −162 text lines

1local map = require 'std.map'
2local user_command = require 'std.user_command'
3
4map.normal {
5 description = 'Toggle task view',
6 category = 'tasks',
7 keys = '<leader>99',
8 command = function () prequire 'overseer'.toggle { enter = true, direction = 'right', } end,
9}
11map.normal {
12 description = 'Run task',
13 category = 'tasks',
14 keys = '<leader>9r',
15 command = function () prequire 'overseer'._run_template() end,
16}
18map.normal {
19 description = 'Run any command as task',
20 category = 'tasks',
21 keys = '<leader>9c',
22 command = function () prequire 'overseer'._run_command() end,
23}
25map.normal {
26 description = 'Load task bundle',
27 category = 'tasks',
28 keys = '<leader>9r',
29 command = function () prequire 'overseer'._load_bundle() end,
30}
32map.normal {
33 description = 'Run an action on the most recent task, or the task under the cursor',
34 category = 'tasks',
35 keys = '<leader>9d',
36 command = function () prequire 'overseer'._quick_action() end,
37}
39map.normal {
40 description = 'Select a task to run an action on',
41 category = 'tasks',
42 keys = '<leader>9s',
43 command = function () prequire 'overseer'._task_action() end,
44}
46map.normal {
47 description = 'Display diagnostic information about overseer',
48 category = 'tasks',
49 keys = '<leader>9i',
50 command = function () prequire 'overseer'._info() end,
51}
53user_command.OverseerDebugParser
54'Open a tab with windows laid out for debugging a parser' (
55 function ()
56 prequire 'overseer'.debug_parser()
57 end
58 )
60user_command.Grep
61'Run your grepprg as an Overseer task'
62 { nargs = '*', bang = true, bar = true, complete = 'file', } (
63 function ( params )
64 local args = vim.fn.expandcmd( params.args )
65 -- Insert args at the '$*' in the grepprg
66 local cmd, num_subs = vim.o.grepprg:gsub( '%$%*', args )
67 if num_subs == 0 then
68 cmd = cmd .. ' ' .. args
69 end
70 local cwd
71 prequire( 'oil', function ( oil )
72 cwd = oil.get_current_dir()
73 end )
74 local task = prequire 'overseer'.new_task {
75 cmd = cmd,
76 cwd = cwd,
77 name = 'grep ' .. args,
78 components = {
79 {
80 'on_output_quickfix',
81 errorformat = vim.o.grepformat,
82 open = not params.bang,
83 open_height = 8,
84 items_only = true,
85 },
86 -- We don't care to keep this around as long as most tasks
87 { 'on_complete_dispose', timeout = 30, },
88 'default',
89 },
90 }
91 task:start()
92 end
93 )
95user_command.Make
96'Run your makeprg as an Overseer task'
97 { nargs = '*', bang = true, } (
98 function ( params )
99 -- Insert args at the '$*' in the makeprg
100 local cmd, num_subs = vim.o.makeprg:gsub( '%$%*', params.args )
101 if num_subs == 0 then
102 cmd = cmd .. ' ' .. params.args
103 end
104 local task = prequire 'overseer'.new_task {
105 cmd = vim.fn.expandcmd( cmd ),
106 components = {
107 { 'on_output_quickfix', open = not params.bang, open_height = 8, },
108 'unique',
109 'default',
110 },
111 }
112 task:start()
113 end
114 )
116return {
117 {
118 'stevearc/resession.nvim',
119 lazy = true,
120 opts = {
121 extensions = {
122 overseer = {
123 status = { 'RUNNING', },
124 },
125 },
126 },
127 },
128 {
129 'stevearc/overseer.nvim',
130 opts = {
131 strategy = { 'jobstart', },
132 dap = false,
133 log = {
134 {
135 type = 'echo',
136 level = vim.log.levels.WARN,
137 },
138 {
139 type = 'file',
140 filename = 'overseer.log',
141 level = vim.log.levels.DEBUG,
142 },
143 },
144 component_aliases = {
145 default = {
146 {
147 'display_duration',
148 detail_level = 2,
149 },
150 'on_output_summarize',
151 'on_exit_set_status',
152 { 'on_complete_notify', system = 'unfocused', },
153 'on_complete_dispose',
154 },
155 default_neotest = {
156 'unique',
157 { 'on_complete_notify', system = 'unfocused', on_change = true, },
158 'default',
159 },
160 },
161 },
162 }, }

neovim/lua/std/project.lua

Modified

+19 / −22 text lines

165165local function find_project_root( path, markers )
166166 -- define some language-independent markers
167167 local default_markers = {
168 { name = '.save.actions.lua', weight = DEFINITELY, },
169 { name = '.lsp.settings.lua', weight = DEFINITELY, },
170 { name = '.lazy.specs.lua', weight = DEFINITELY, },
171 { name = '.editorconfig', weight = LIKELY, },
172 { name = '.git', weight = LIKELY, },
173 { name = '.gitignore', weight = LIKELY, },
174 { name = '.svn', weight = LIKELY, },
175 { name = 'justfile', weight = LIKELY, },
176 { name = 'Makefile', weight = LIKELY, },
177 { name = 'Jenkinsfile', weight = MAYBE, },
178 { name = 'LICENSE', weight = MAYBE, },
179 { name = 'LICENSE.md', weight = MAYBE, },
180 { name = 'LICENSE.txt', weight = MAYBE, },
181 { name = 'COPYING', weight = MAYBE, },
182 { name = 'README', weight = MAYBE, },
183 { name = 'README.md', weight = MAYBE, },
184 { name = 'flake.nix', weight = MAYBE, },
185 { name = 'flake.nix', weight = MAYBE, },
168 { name = '.save.actions.lua', weight = DEFINITELY, },
169 { name = '.lsp.settings.lua', weight = DEFINITELY, },
170 { name = '.lsp.workspace_folders.lua', weight = DEFINITELY, },
171 { name = '.lazy.specs.lua', weight = DEFINITELY, },
172 { name = '.editorconfig', weight = LIKELY, },
173 { name = '.git', weight = LIKELY, },
174 { name = '.gitignore', weight = LIKELY, },
175 { name = '.svn', weight = LIKELY, },
176 { name = 'justfile', weight = LIKELY, },
177 { name = 'Makefile', weight = LIKELY, },
178 { name = 'Jenkinsfile', weight = MAYBE, },
179 { name = 'LICENSE', weight = MAYBE, },
180 { name = 'LICENSE.md', weight = MAYBE, },
181 { name = 'LICENSE.txt', weight = MAYBE, },
182 { name = 'COPYING', weight = MAYBE, },
183 { name = 'README', weight = MAYBE, },
184 { name = 'README.md', weight = MAYBE, },
185 { name = 'flake.nix', weight = MAYBE, },
186 { name = 'flake.nix', weight = MAYBE, },
186187 }
188189 markers = markers or {}
286287 return rooter and rooter( path ) or fallback_rooter( path )
287288end
289--- @return table parsed configuration as could be found in the `.project_model` file in the root directory. Empty otherwise.
290local parse_project_configuration = function ()
291end
293290return {
294291 find_root = find_root,
295292 find_root_by_filetype = find_root_by_filetype,

neovim/spell/nerd.utf-8.add

Modified

+2 / −0 text lines

5959modulepath
6060FFI
6161jdtls
62href
63DocumentUri
6264sinnfrei

neovim/spell/nerd.utf-8.add.spl

Modified

Binary size (old → new): 822 → 848 bytes.