repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: rename plugin file to plugin names

4b50618500f4dff038cff61066d1f49ed2398f60

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (23)

neovim/README.md

Modified
39 39 # todo
41 +* remove mason
41 42 * make highlights more visible when expanding snippets
42 43 * fix bug:
43 44 cursor restore position on (session?) load jumps one location to somewhere

neovim/lazy-lock.json

Modified
2 2 "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
3 - "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
3 + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
4 4 "actions-preview.nvim": { "branch": "master", "commit": "5072b1b1065a6b22bdd46b5c21780a91d6a08071" },
5 5 "auto-dark-mode.nvim": { "branch": "master", "commit": "e328dc463d238cb7d690fb4daf068eba732a5a14" },
6 6 "better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
10 10 "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
11 11 "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
12 12 "colorizer.nvim": { "branch": "master", "commit": "107719885290366c893e1c1c58b7474cbeabfef6" },
13 - "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
13 + "conform.nvim": { "branch": "master", "commit": "a6965ac128eba75537ec2bc5ddd5d5e357062bdc" },
14 14 "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
15 15 "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
16 16 "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
17 17 "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
18 - "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
18 + "gitsigns.nvim": { "branch": "main", "commit": "52f8da33cc0cadbf1164c4a91c8bfd6895533d67" },
19 19 "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
20 20 "heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
21 21 "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
22 22 "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
23 23 "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
24 24 "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
25 - "mason-tool-installer.nvim": { "branch": "main", "commit": "6c15772d5e4a01d0b2ad3ad6df23cf38517c4ad2" },
25 + "mason-tool-installer.nvim": { "branch": "main", "commit": "b129892f783740e6cf741f2ea09fa5dd512aa584" },
26 26 "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
27 27 "mini.bracketed": { "branch": "main", "commit": "65c7dfb51e832de9e279e5d5b0741e7af6755ab5" },
28 28 "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
29 29 "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
30 30 "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" },
31 - "neorg": { "branch": "main", "commit": "7c5464722a4e8240efd9ecd7bef85d38f94c1ab5" },
31 + "neorg": { "branch": "main", "commit": "c17b8e9e7327e03f78fbdccfb15abd09ec607bd0" },
32 32 "neotest": { "branch": "master", "commit": "f03a78cef74db5638e4312e18b767294a90de8da" },
33 33 "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" },
34 34 "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" },
35 35 "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
36 36 "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
37 37 "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
38 - "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
38 + "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" },
39 39 "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
40 40 "nvim-dap-virtual-text": { "branch": "master", "commit": "3e8e207513e6ef520894950acd76b79902714103" },
41 - "nvim-genghis": { "branch": "main", "commit": "8613fc1b43db6cc761733b3630eabff9e86296f7" },
41 + "nvim-genghis": { "branch": "main", "commit": "1e6855be88e2266c612903dbc337222b59a06e44" },
42 42 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
43 43 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
44 44 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
45 - "nvim-lint": { "branch": "master", "commit": "4055dc856d5ac8f6b85748006fd8fa6457e086e8" },
45 + "nvim-lint": { "branch": "master", "commit": "f098232d70cebe90e27404928c9bc19ca7a5a7b5" },
46 46 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
47 47 "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" },
48 48 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
49 49 "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
50 50 "nvim-nio": { "branch": "master", "commit": "5a3a06e5df34f1b4fc1500622b10620c49c60da6" },
51 - "nvim-spectre": { "branch": "master", "commit": "2b012554a2536465243c0dff3605b5927c49ed23" },
52 - "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
51 + "nvim-spectre": { "branch": "master", "commit": "9653847cf2f225648967f6e9363643e327387579" },
52 + "nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
53 53 "nvim-tree.lua": { "branch": "master", "commit": "ddd1d6eb21c45433bdc65cc8015f2457998f2bf2" },
54 - "nvim-treesitter": { "branch": "master", "commit": "2bad828b48aed74efe8f7e4ea15550e18c7b482d" },
54 + "nvim-treesitter": { "branch": "master", "commit": "baaae36ac709f405c0ee5d39ef9ffd8d8160f1a3" },
55 55 "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
56 - "nvim-treesitter-textobjects": { "branch": "master", "commit": "252e65409bc783b0d154f3a341e423c2c4475b26" },
56 + "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
57 57 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
58 - "nvim-ts-context-commentstring": { "branch": "main", "commit": "734ebad31c81c6198dfe102aa23280937c937c42" },
59 - "nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" },
58 + "nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" },
59 + "nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" },
60 60 "nvim-window": { "branch": "main", "commit": "fad0dc96de265b0bdcb21d1071329e5ab1deb4af" },
61 - "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
62 - "overseer.nvim": { "branch": "master", "commit": "b04b0b105c07b4f02b3073ea3a98d6eca90bf152" },
61 + "oil.nvim": { "branch": "master", "commit": "8bb35eb81a48f14c4a1ef480c2bbb87ceb7cd8bb" },
62 + "overseer.nvim": { "branch": "master", "commit": "dd701ed0639ef1e10d0ca8dec039719e916c4a7b" },
63 63 "pair-ls.nvim": { "branch": "master", "commit": "e7a8f55f54a6a1956b782ddefba79dc6bb308d1d" },
64 64 "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
65 65 "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
66 66 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
67 67 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
68 - "schemastore.nvim": { "branch": "main", "commit": "c5d5abc86910fb31b9f734cae2547322e81d3a26" },
69 - "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
68 + "schemastore.nvim": { "branch": "main", "commit": "f7cae6f1b38cb296f48ce1a9c5ed1a419d912a42" },
69 + "specs.nvim": { "branch": "main", "commit": "8a108c8b37dec1b184a1d3d76c6cf867bfbe9636" },
70 70 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
71 71 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },
72 72 "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
73 - "suda.vim": { "branch": "master", "commit": "66727b416837836712975e748bc8a19fb6cf4ec3" },
73 + "suda.vim": { "branch": "master", "commit": "04469d855e36fffcda6be036eb7ff005f64fa0d6" },
74 74 "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
75 75 "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
76 76 "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" },
77 77 "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
78 78 "tint.nvim": { "branch": "master", "commit": "862835626941d263466754b9c8e2ce2cb004f5ac" },
79 79 "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
80 - "tree-sitter-nu": { "branch": "main", "commit": "c5b7816043992b1cdc1462a889bc74dc08576fa6" },
80 + "tree-sitter-nu": { "branch": "main", "commit": "b090676f0205f52debb93745b9ad788385583276" },
81 81 "treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
82 82 "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
83 - "venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" },
83 + "venn.nvim": { "branch": "main", "commit": "a5430d75875acbe93e9685cdeb78c6eb2a329ed5" },
84 84 "vim-vscode-snippets": { "branch": "master", "commit": "812e60d1c648f889328761ec71daff09d1eb3177" },
85 85 "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" },
86 86 "which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" },

neovim/lua/bugabinga/diagnostic.lua

Modified
2 2 local map = require 'std.map'
3 3 local auto = require 'std.auto'
4 4 local icon = require 'std.icon'
6 -local diagnostic_icons = { icon.error, icon.warn, icon.info, icon.hint }
6 +local diagnostic_icons = { icon.error, icon.warn, icon.info, icon.hint, }
7 7 diagnostic_icons.error = diagnostic_icons[1]
8 8 diagnostic_icons.warn = diagnostic_icons[2]
9 9 diagnostic_icons.info = diagnostic_icons[3]
10 10 diagnostic_icons.hint = diagnostic_icons[4]
12 12 local display_name = {
13 - 'Error',
14 - 'Warning',
15 - 'Information',
16 - 'Hint',
13 + 'Error',
14 + 'Warning',
15 + 'Information',
16 + 'Hint',
19 19 local diagnostic = vim.diagnostic
20 20 diagnostic.disable( 0 )
22 22 auto 'disable_diagnostic_initially' {
23 - description = 'Disable Diagnostics initially, when attaching an LSP client to a buffer',
24 - events = 'LspAttach',
25 - command = function () diagnostic.disable( 0 ) end,
23 + description = 'Disable Diagnostics initially, when attaching an LSP client to a buffer',
24 + events = 'LspAttach',
25 + command = function () diagnostic.disable( 0 ) end,
28 28 local diagnostic_format = function ( context )
29 - return string.format( '%s: %s', display_name[context.severity], context.message )
29 + return string.format( '%s: %s', display_name[context.severity], context.message )
32 32 local prefix_format = function ( context, index, total )
33 - return string.format( '%s/%s %s %s ', index, total, context.source, diagnostic_icons[context.severity] ),
34 - 'DiagnosticVirtualText' .. display_name[context.severity]
33 + return string.format( '%s/%s %s %s ', index, total, context.source, diagnostic_icons[context.severity] ),
34 + 'DiagnosticVirtualText' .. display_name[context.severity]
37 37 diagnostic.config {
38 - underline = true,
39 - virtual_text = {
40 - severity = { min = diagnostic.severity.WARN },
41 - source = false,
42 - spacing = 2,
43 - prefix = '⦿ ',
44 - format = diagnostic_format,
45 - },
46 - float = {
47 - focusable = false,
48 - style = 'minimal',
49 - border = vim.g.border_style,
50 - source = 'if_many',
51 - header = 'Diagnostic',
52 - prefix = prefix_format,
53 - },
54 - update_in_insert = false,
55 - signs = true,
56 - severity_sort = true,
38 + underline = true,
39 + virtual_text = {
40 + severity = { min = diagnostic.severity.WARN, },
41 + source = false,
42 + spacing = 2,
43 + prefix = '⦿ ',
44 + format = diagnostic_format,
45 + },
46 + float = {
47 + focusable = false,
48 + style = 'minimal',
49 + border = vim.g.border_style,
50 + source = 'if_many',
51 + header = 'Diagnostic',
52 + prefix = prefix_format,
53 + },
54 + update_in_insert = false,
55 + signs = true,
56 + severity_sort = true,
59 59 local sign = function ( options )
60 - vim.fn.sign_define( options.name, {
61 - text = options.text,
62 - texthl = options.name,
63 - numhl = nil,
64 - culhl = nil,
65 - linehl = nil,
66 - } )
60 + vim.fn.sign_define( options.name, {
61 + text = options.text,
62 + texthl = options.name,
63 + numhl = nil,
64 + culhl = nil,
65 + linehl = nil,
66 + } )
69 -sign { name = 'DiagnosticSignError', text = diagnostic_icons.error }
70 -sign { name = 'DiagnosticSignWarn', text = diagnostic_icons.warn }
71 -sign { name = 'DiagnosticSignHint', text = diagnostic_icons.hint }
72 -sign { name = 'DiagnosticSignInfo', text = diagnostic_icons.info }
69 +sign { name = 'DiagnosticSignError', text = diagnostic_icons.error, }
70 +sign { name = 'DiagnosticSignWarn', text = diagnostic_icons.warn, }
71 +sign { name = 'DiagnosticSignHint', text = diagnostic_icons.hint, }
72 +sign { name = 'DiagnosticSignInfo', text = diagnostic_icons.info, }
74 74 -- TODO: move to togglers
75 75 map.normal {
76 - description = 'Toggle diagnostics',
77 - category = 'diagnostic',
78 - keys = '<leader>td',
79 - command = function ()
80 - if diagnostic.is_disabled( 0 ) then
81 - diagnostic.enable( 0 )
82 - vim.notify 'Enabling Diagnostics'
83 - else
84 - diagnostic.disable( 0 )
85 - vim.notify 'Disabling Diagnostics'
86 - end
87 - end,
76 + description = 'Toggle diagnostics',
77 + category = 'diagnostic',
78 + keys = '<leader>td',
79 + command = function ()
80 + if diagnostic.is_disabled( 0 ) then
81 + diagnostic.enable( 0 )
82 + vim.notify 'Enabling Diagnostics'
83 + else
84 + diagnostic.disable( 0 )
85 + vim.notify 'Disabling Diagnostics'
86 + end
87 + end,
90 90 map.normal {
91 - description = 'Show diagnostics under cursor',
92 - category = 'diagnostic',
93 - keys = 'H',
94 - command = diagnostic.open_float,
91 + description = 'Show diagnostics under cursor',
92 + category = 'diagnostic',
93 + keys = 'H',
94 + command = diagnostic.open_float,
97 +map.normal {
98 + description = 'Open diagnostics in quickfix list.',
99 + category = 'diagnostic',
100 + keys = 'HH',
101 + command = diagnostic.setqflist,
97 104 local show_diagnostics_in_buffer = function ()
98 - local builtin = require 'telescope.builtin'
99 - builtin.diagnostics { bufnr = 0 }
105 + local builtin = require 'telescope.builtin'
106 + builtin.diagnostics { bufnr = 0, }
102 109 map.normal {
103 - description = 'Show all diagnostics in buffer',
104 - category = 'diagnostic',
105 - keys = '<F6>',
106 - command = show_diagnostics_in_buffer,
110 + description = 'Show all diagnostics in buffer',
111 + category = 'diagnostic',
112 + keys = '<F6>',
113 + command = show_diagnostics_in_buffer,
109 116 local show_diagnostics_in_workspace = function ()
110 - local builtin = require 'telescope.builtin'
111 - builtin.diagnostics()
117 + local builtin = require 'telescope.builtin'
118 + builtin.diagnostics()
114 121 map.normal {
115 - description = 'Show all diagnostics in workspace',
116 - category = 'diagnostic',
117 - keys = '<F6><F6>',
118 - command = show_diagnostics_in_workspace,
122 + description = 'Show all diagnostics in workspace',
123 + category = 'diagnostic',
124 + keys = '<F6><F6>',
125 + command = show_diagnostics_in_workspace,
121 128 -- a little debug helper to show all kinds of diagnostics
123 130 local dia = function ( severity, line )
124 - local ns = vim.api.nvim_create_namespace( 'test' .. tostring( severity ) )
125 - local bufnr = vim.api.nvim_get_current_buf()
126 - local options = {
127 - bufnr = bufnr,
128 - lnum = line,
129 - end_lnum = line,
130 - col = 0,
131 - severity = severity,
132 - message = 'This is a test ' .. tostring( severity ) .. ' diagnostic',
133 - }
131 + local ns = vim.api.nvim_create_namespace( 'test' .. tostring( severity ) )
132 + local bufnr = vim.api.nvim_get_current_buf()
133 + local options = {
134 + bufnr = bufnr,
135 + lnum = line,
136 + end_lnum = line,
137 + col = 0,
138 + severity = severity,
139 + message = 'This is a test ' .. tostring( severity ) .. ' diagnostic',
135 - vim.diagnostic.set( ns, bufnr, { options } )
136 - vim.diagnostic.show( ns, bufnr, { options } )
142 + vim.diagnostic.set( ns, bufnr, { options, } )
143 + vim.diagnostic.show( ns, bufnr, { options, } )
139 146 local send_dia = function ()
140 - dia( vim.diagnostic.severity.ERROR, 1 )
141 - dia( vim.diagnostic.severity.WARN, 2 )
142 - dia( vim.diagnostic.severity.INFO, 3 )
143 - dia( vim.diagnostic.severity.HINT, 4 )
147 + dia( vim.diagnostic.severity.ERROR, 1 )
148 + dia( vim.diagnostic.severity.WARN, 2 )
149 + dia( vim.diagnostic.severity.INFO, 3 )
150 + dia( vim.diagnostic.severity.HINT, 4 )
146 153 vim.g.send_dia = send_dia

neovim/lua/bugabinga/lsp/init.lua

Modified
1 -local debug = require 'std.dbg'
1 +local dbg = require 'std.dbg'
2 2 local icon = require 'std.icon'
3 3 local defer = require 'std.defer'
4 4 local map = require 'std.map'
15 15 require 'bugabinga.lsp.lightbulb'
17 17 local 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
33 33 local 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
41 41 local 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 )
52 52 local 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,
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, },
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
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
200 235 local old_formatexpr
204 239 local keybinds = {}
205 240 local 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', },
245 + if not table.contains( keybinds, client_id ) then
246 + keybinds[client_id] = {}
247 + end
248 + table.insert( keybinds[client_id], keybind_remover )
216 251 local 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,
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' {
304 + description = 'Highlight symbol under cursor on hold',
305 + events = 'CursorHold',
306 + buffer = bufnr,
307 + command = debounced_highlight,
308 + },
310 + description = 'Remove highlight from symbol under cursor on move',
311 + events = { 'CursorMoved', 'InsertEnter', },
312 + buffer = bufnr,
313 + command = debounced_clear,
314 + },
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 + } )
368 403 local 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
395 430 auto '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 - },
432 + description = 'Start or reuse LSP client',
433 + events = 'FileType',
434 + command = lsp_start,
435 + },
437 + description = 'Hook: LSP client attached to buffer',
438 + events = 'LspAttach',
439 + command = lsp_attach,
440 + },
442 + description = 'Hook: LSP client detached from buffer',
443 + events = 'LspDetach',
444 + command = lsp_detach,
445 + },
447 + description = 'Semantic Tokens from the LSP',
448 + events = 'LspTokenUpdate',
449 + command = token_update,
450 + },
418 453 local 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,
475 + return basic
476 + end )
477 + :totable()
444 - ui.show_tree( infos )
479 + ui.show_tree( infos )
447 482 local 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 )
453 488 user_command.LspInfo
454 489 '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
459 494 user_command.LspInfoExtended
460 495 '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
465 500 -- TODO: LspStart
466 501 -- TODO: LspStop
467 502 -- TODO: LspRestart ? Maybe good after changing project local settings?
469 504 local 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,
493 528 local completion_kinds = vim.lsp.protocol.CompletionItemKind
494 529 for 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
498 533 return setmetatable( _, {} )

neovim/lua/bugabinga/options/behaviour.lua

Modified
25 25 -- insert whitespace type based on whitespace on previous line
26 26 vim.opt.smarttab = true
28 -vim.opt.wrap = false
28 +vim.opt.wrap = true
29 +vim.opt.breakindent = true
30 31 -- do not keep distance to borders while scrolling
31 32 vim.opt.scrolloff = 0

neovim/lua/bugabinga/options/ui.lua

Modified
3 3 local icon = require 'std.icon'
4 4 local auto = require 'std.auto'
5 5 local ignored = require 'std.ignored'
7 7 auto 'highlight_yanked_text' {
8 - description = 'briefly highlight yanked text',
9 - events = 'TextYankPost',
10 - pattern = '*',
11 - command = function () vim.highlight.on_yank() end,
8 + description = 'briefly highlight yanked text',
9 + events = 'TextYankPost',
10 + pattern = '*',
11 + command = function () vim.highlight.on_yank() end,
14 14 auto 'disable_columns_in_special_buffers' {
15 - description = 'Hide columns in buffers, that do not show source code.',
16 - events = { 'FileType', },
17 - pattern = ignored.filetypes,
18 - command = function ()
19 - vim.opt_local.colorcolumn = {}
20 - vim.opt_local.signcolumn = 'no'
21 - vim.opt_local.foldcolumn = '0'
22 - vim.opt_local.number = false
23 - end,
15 + description = 'Hide columns in buffers, that do not show source code.',
16 + events = { 'FileType', },
17 + pattern = ignored.filetypes,
18 + command = function ()
19 + vim.opt_local.colorcolumn = {}
20 + vim.opt_local.signcolumn = 'no'
21 + vim.opt_local.foldcolumn = '0'
22 + vim.opt_local.number = false
23 + end,
26 26 -- show trailing whitespace
27 27 vim.opt.list = true
28 28 vim.opt.listchars = {
29 - -- space = icon.space,
30 - -- eol = icon.eol,
31 - -- tab = icon.tab .. icon.middle_ellipsis,
32 - tab = ' ',
33 - trail = icon.trail,
34 - extends = icon.extends,
35 - precedes = icon.precedes,
36 - nbsp = icon.nbsp,
29 + -- space = icon.space,
30 + -- eol = icon.eol,
31 + -- tab = icon.tab .. icon.middle_ellipsis,
32 + tab = ' ',
33 + trail = icon.trail,
34 + extends = icon.extends,
35 + precedes = icon.precedes,
36 + nbsp = icon.nbsp,
39 39 -- force English messages
55 55 -- hide weird symbol at end of buffer
56 56 vim.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 = '┼',
71 71 -- better have no syntax highlighting than regex based, treesitter will take over later
72 72 vim.opt.syntax = 'off'
74 74 -- hide output of insert completion popup in status
75 -vim.opt.shortmess:append 'c'
75 +-- vim.opt.shortmess:append 'c'
76 76 -- hide vim intro screen
77 77 vim.opt.shortmess:append 'I'
78 78 -- truncate messages at end
79 -vim.opt.shortmess:append 't'
79 +-- vim.opt.shortmess:append 't'
81 81 -- show cmd window to prevent jitter UI
82 82 vim.opt.cmdheight = 1
100 100 vim.opt.pumblend = 0
101 101 vim.opt.winblend = 0
103 -vim.g.border_style = 'shadow'
103 +vim.g.border_style = 'solid'
105 105 -- hide the mode indicator in status
106 106 vim.opt.showmode = false
111 111 local is_tty = os.getenv 'XDG_SESSION_TYPE' == 'tty' and os.getenv 'SSH_TTY' == ''
112 112 if is_tty then
113 - vim.opt.termguicolors = false
114 - vim.g.nerdfont = false
115 - vim.opt.lazyredraw = true
113 + vim.opt.termguicolors = false
114 + vim.g.nerdfont = false
115 + vim.opt.lazyredraw = true
117 - vim.opt.termguicolors = true
118 - vim.g.nerdfont = true
119 - vim.opt.lazyredraw = false
117 + vim.opt.termguicolors = true
118 + vim.g.nerdfont = true
119 + vim.opt.lazyredraw = false
122 122 -- scroll by screen lines if buffer is wrapped
134 134 -- neovide only options
135 135 if vim.g.neovide then
136 - -- vim.g.neovide_floating_blur_amount_x = 12.0
137 - -- vim.g.neovide_floating_blur_amount_y = 12.0
138 - -- vim.g.neovide_scroll_animation_length = 0.69
139 - -- vim.g.neovide_fullscreen = true
140 - vim.g.neovide_remember_window_size = true
141 - vim.g.neovide_profiler = false
142 - -- vim.g.neovide_cursor_animation_length = 0.42
143 - -- vim.g.neovide_cursor_trail_length = 0.42
144 - vim.g.neovide_cursor_vfx_mode = 'railgun'
145 - -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
146 - vim.g.neovide_cursor_antialiasing = true
147 - vim.g.neovide_padding_top = 0
148 - vim.g.neovide_padding_bottom = 0
149 - vim.g.neovide_padding_right = 0
150 - vim.g.neovide_padding_left = 0
151 - vim.g.neovide_hide_mouse_when_typing = true
152 - vim.g.neovide_theme = 'auto'
153 - vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
154 - vim.g.neovide_refresh_rate_idle = 5
136 + -- vim.g.neovide_floating_blur_amount_x = 12.0
137 + -- vim.g.neovide_floating_blur_amount_y = 12.0
138 + -- vim.g.neovide_scroll_animation_length = 0.69
139 + -- vim.g.neovide_fullscreen = true
140 + vim.g.neovide_remember_window_size = true
141 + vim.g.neovide_profiler = false
142 + -- vim.g.neovide_cursor_animation_length = 0.42
143 + -- vim.g.neovide_cursor_trail_length = 0.42
144 + vim.g.neovide_cursor_vfx_mode = 'railgun'
145 + -- vim.g.neovide_cursor_unfocused_outline_width = 0.125
146 + vim.g.neovide_cursor_antialiasing = true
147 + vim.g.neovide_padding_top = 0
148 + vim.g.neovide_padding_bottom = 0
149 + vim.g.neovide_padding_right = 0
150 + vim.g.neovide_padding_left = 0
151 + vim.g.neovide_hide_mouse_when_typing = true
152 + vim.g.neovide_theme = 'auto'
153 + vim.g.neovide_refresh_rate = vim.uv.os_gethostname() == 'pop-os' and 144 or 60
154 + vim.g.neovide_refresh_rate_idle = 5

neovim/lua/bugabinga/plugins/conform.lua

Added
new file mode 100644
1 +local debug = require 'std.dbg'
2 +local map = require 'std.map'
3 +local user_command = require 'std.user_command'
5 +local 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 )
11 +end
13 +map.N {
14 + description = 'Format buffer',
15 + category = 'format',
16 + keys = '=',
17 + command = format,
20 +user_command.Format
21 +'Format the current buffer' (
22 + format
23 + )
25 +return {
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,

neovim/lua/bugabinga/plugins/format.lua

Deleted
deleted file mode 100644
1 -local debug = require 'std.dbg'
2 -local map = require 'std.map'
3 -local user_command = require 'std.user_command'
5 -local 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 )
11 -end
13 -map.N {
14 - description = 'Format buffer',
15 - category = 'format',
16 - keys = '=',
17 - command = format,
18 -}
20 -user_command.Format
21 -'Format the current buffer' (
22 - format
23 - )
25 -return {
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 +return { 'bugabinga/nvim-jdtls', }

neovim/lua/bugabinga/plugins/luasnip.lua

Added
new file mode 100644
1 +--FIXME: own this
2 +return {
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,
113 + end,

neovim/lua/bugabinga/plugins/navbuddy.lua

Added
new file mode 100644
1 +local map = require 'std.map'
3 +return {
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 + },

neovim/lua/bugabinga/plugins/neogen.lua

Modified
1 1 local map = require 'std.map'
3 3 map.normal {
4 - description = 'Generate doc comment for outer element',
5 - category = 'editing',
6 - keys = '<leader>gd',
4 + description = 'Doc Comment',
5 + category = 'generate',
6 + keys = '<leader>gdd',
7 7 command = function () require 'neogen'.generate() end,
10 10 map.normal {
11 - name = 'Generate Doc Comment for Function',
12 - category = 'editing',
13 - keys = '<leader>gdf',
11 + name = 'Doc Comment for Function',
12 + category = 'generate',
13 + keys = '<leader>gdm',
14 14 command = function () require 'neogen'.generate { type = 'func', } end,
17 17 map.normal {
18 - description = 'Generate Doc Comment for File',
19 - category = 'editing',
20 - keys = '<leader>gdF',
18 + description = 'Doc Comment for File',
19 + category = 'generate',
20 + keys = '<leader>gdf',
21 21 command = function () require 'neogen'.generate { type = 'file', } end,
24 24 map.normal {
25 - description = 'Generate Doc Comment for Class',
26 - category = 'editing',
25 + description = 'Doc Comment for Class',
26 + category = 'generate',
27 27 keys = '<leader>gdc',
28 28 command = function () require 'neogen'.generate { type = 'class', } end,

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

Deleted
deleted file mode 100644
1 -return { 'bugabinga/nvim-jdtls', }

neovim/lua/bugabinga/plugins/outline.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -return {
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
1 +local map = require 'std.map'
2 +local user_command = require 'std.user_command'
4 +map.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 +}
11 +map.normal {
12 + description = 'Run task',
13 + category = 'tasks',
14 + keys = '<leader>9r',
15 + command = function () prequire 'overseer'._run_template() end,
18 +map.normal {
19 + description = 'Run any command as task',
20 + category = 'tasks',
21 + keys = '<leader>9c',
22 + command = function () prequire 'overseer'._run_command() end,
25 +map.normal {
26 + description = 'Load task bundle',
27 + category = 'tasks',
28 + keys = '<leader>9r',
29 + command = function () prequire 'overseer'._load_bundle() end,
32 +map.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,
39 +map.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,
46 +map.normal {
47 + description = 'Display diagnostic information about overseer',
48 + category = 'tasks',
49 + keys = '<leader>9i',
50 + command = function () prequire 'overseer'._info() end,
53 +user_command.OverseerDebugParser
54 +'Open a tab with windows laid out for debugging a parser' (
55 + function ()
56 + prequire 'overseer'.debug_parser()
57 + end
58 + )
60 +user_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 + )
95 +user_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 + },
112 + task:start()
113 + end
116 +return {
118 + 'stevearc/resession.nvim',
119 + lazy = true,
120 + opts = {
121 + extensions = {
122 + overseer = {
123 + status = { 'RUNNING', },
124 + },
125 + },
126 + },
127 + },
129 + 'stevearc/overseer.nvim',
130 + opts = {
131 + strategy = { 'jobstart', },
132 + dap = false,
133 + log = {
135 + type = 'echo',
136 + level = vim.log.levels.WARN,
137 + },
139 + type = 'file',
140 + filename = 'overseer.log',
141 + level = vim.log.levels.DEBUG,
142 + },
143 + },
144 + component_aliases = {
145 + default = {
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
1 +local map = require 'std.map'
3 +map.normal {
4 + description = 'Grep search for word under cursor',
5 + category = 'search',
6 + keys = 'gw',
7 + command = '<cmd>cclose <bar> Grep <cword><cr>',
8 +}
10 +map.normal {
11 + description = 'Goto next quickfix item',
12 + category = 'navigation',
13 + keys = ']q',
14 + command = '<cmd>QNext<cr>',
17 +map.normal {
18 + description = 'Goto previous quickfix item',
19 + category = 'navigation',
20 + keys = '[q',
21 + command = '<cmd>QPrev<cr>',
24 +map.normal {
25 + description = 'Toggle open quickfix window',
26 + category = 'navigation',
27 + keys = '<leader>Q',
28 + command = '<cmd>QFToggle!<CR>',
31 +map.normal {
32 + description = 'Toggle open loclist window',
33 + category = 'navigation',
34 + keys = '<leader>L',
35 + command = '<cmd>LLToggle!<CR>',
38 +return {
39 + 'stevearc/qf_helper.nvim',
40 + ft = 'qf',
41 + cmd = { 'QNext', 'QPrev', 'QFToggle', 'QFOpen', 'LLToggle', },
42 + opts = {
43 + prefer_loclist = false,
44 + },

neovim/lua/bugabinga/plugins/quickfix.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -map.normal {
4 - description = 'Grep search for word under cursor',
5 - category = 'search',
6 - keys = 'gw',
7 - command = '<cmd>cclose <bar> Grep <cword><cr>',
8 -}
10 -map.normal {
11 - description = 'Goto next quickfix item',
12 - category = 'navigation',
13 - keys = ']q',
14 - command = '<cmd>QNext<cr>',
15 -}
17 -map.normal {
18 - description = 'Goto previous quickfix item',
19 - category = 'navigation',
20 - keys = '[q',
21 - command = '<cmd>QPrev<cr>',
22 -}
24 -map.normal {
25 - description = 'Toggle open quickfix window',
26 - category = 'navigation',
27 - keys = '<leader>Q',
28 - command = '<cmd>QFToggle!<CR>',
29 -}
31 -map.normal {
32 - description = 'Toggle open loclist window',
33 - category = 'navigation',
34 - keys = '<leader>L',
35 - command = '<cmd>LLToggle!<CR>',
36 -}
38 -return {
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
1 ---FIXME: own this
2 -return {
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,

neovim/lua/bugabinga/plugins/spectre.lua

Modified
9 9 description = 'Search and replace',
10 10 category = 'search',
11 11 keys = '<leader>rs',
12 - command = function () spectre.open() end,
12 + command = function () require 'spectre'.open() end,
15 15 map.normal {
16 16 description = 'Search current word',
17 17 category = 'search',
18 18 keys = '<leader>rw',
19 - command = function () spectre.open_visual { select_word = true, } end,
19 + command = function () require 'spectre'.open_visual { select_word = true, } end,
22 22 map.visual {
23 23 description = 'Search current word',
24 24 category = 'search',
25 25 keys = '<leader>rw',
26 - command = function () spectre.open_visual() end,
26 + command = function () require 'spectre'.open_visual() end,
29 29 map.normal {
30 30 description = 'Search on current file',
31 31 category = 'search',
32 32 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,
36 36 return {

neovim/lua/bugabinga/plugins/tasks.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
2 -local user_command = require 'std.user_command'
4 -map.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 -}
11 -map.normal {
12 - description = 'Run task',
13 - category = 'tasks',
14 - keys = '<leader>9r',
15 - command = function () prequire 'overseer'._run_template() end,
18 -map.normal {
19 - description = 'Run any command as task',
20 - category = 'tasks',
21 - keys = '<leader>9c',
22 - command = function () prequire 'overseer'._run_command() end,
25 -map.normal {
26 - description = 'Load task bundle',
27 - category = 'tasks',
28 - keys = '<leader>9r',
29 - command = function () prequire 'overseer'._load_bundle() end,
32 -map.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,
39 -map.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,
46 -map.normal {
47 - description = 'Display diagnostic information about overseer',
48 - category = 'tasks',
49 - keys = '<leader>9i',
50 - command = function () prequire 'overseer'._info() end,
53 -user_command.OverseerDebugParser
54 -'Open a tab with windows laid out for debugging a parser' (
55 - function ()
56 - prequire 'overseer'.debug_parser()
57 - end
58 - )
60 -user_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 - )
95 -user_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 - )
116 -return {
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
164 164 local function find_project_root( path, markers )
165 165 -- define some language-independent markers
166 166 local default_markers = {
167 - { name = '.save.actions.lua', weight = DEFINITELY, },
168 - { name = '.lsp.settings.lua', weight = DEFINITELY, },
169 - { name = '.lazy.specs.lua', weight = DEFINITELY, },
170 - { name = '.editorconfig', weight = LIKELY, },
171 - { name = '.git', weight = LIKELY, },
172 - { name = '.gitignore', weight = LIKELY, },
173 - { name = '.svn', weight = LIKELY, },
174 - { name = 'justfile', weight = LIKELY, },
175 - { name = 'Makefile', weight = LIKELY, },
176 - { name = 'Jenkinsfile', weight = MAYBE, },
177 - { name = 'LICENSE', weight = MAYBE, },
178 - { name = 'LICENSE.md', weight = MAYBE, },
179 - { name = 'LICENSE.txt', weight = MAYBE, },
180 - { name = 'COPYING', weight = MAYBE, },
181 - { name = 'README', weight = MAYBE, },
182 - { name = 'README.md', weight = MAYBE, },
183 - { name = 'flake.nix', weight = MAYBE, },
184 - { name = 'flake.nix', weight = MAYBE, },
167 + { name = '.save.actions.lua', weight = DEFINITELY, },
168 + { name = '.lsp.settings.lua', weight = DEFINITELY, },
169 + { name = '.lsp.workspace_folders.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, },
187 188 markers = markers or {}
285 286 return rooter and rooter( path ) or fallback_rooter( path )
288 ---- @return table parsed configuration as could be found in the `.project_model` file in the root directory. Empty otherwise.
289 -local parse_project_configuration = function ()
290 -end
292 289 return {
293 290 find_root = find_root,
294 291 find_root_by_filetype = find_root_by_filetype,

neovim/spell/nerd.utf-8.add

Modified
57 57 modulepath
59 59 jdtls
60 +href
61 +DocumentUri

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

Modified

Previous version contains binary or non-UTF-8 data.

Current version contains binary or non-UTF-8 data.