repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: new textobject and lsp bindings

cfbbb150ce19634ead56e44e367ec6e97e5f378c

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (16)

helix/config.toml

Modified
1 -theme = "nugu-light"
1 +theme = "nugu-dark"
3 3 [editor]
4 4 shell = ["nu", "--commands"]

neovim/colors/nugu.lua

Modified
3 3 if vim.g.colors_name == nil then
4 4 -- Get the current hour
5 5 local current_hour = tonumber(os.date('%H'))
7 7 -- Set the background based on the time of day
8 - if current_hour >= 9 and current_hour < 21 then
8 + if current_hour >= 9 and current_hour < 19 then
9 9 vim.opt.background = 'light'
10 10 else
11 11 vim.opt.background = 'dark'

neovim/init.lua

Modified
22 22 -- [ ] use ltex-ls for markdown, code comments and commit messages
23 23 -- [ ] DAP
24 24 -- [ ] add nu-check to nvim-lint
25 +-- [ ] replace hydra with normal mapping + whcihkey

neovim/lua/bugabinga/lsp/clients/c.lua

Modified
1 1 local project = require'std.project'
3 3 return {
4 - description = 'clangd',
4 + name = 'clangd',
5 5 command = 'clangd',
6 6 filetypes = 'c',
7 7 root_dir = project.find_vcs_project_root,
16 16 offsetEncoding = { 'utf-8', 'utf-16' },
18 -}

neovim/lua/bugabinga/lsp/clients/java.lua

Modified
105 105 return {
106 + name = 'jdtls',
106 107 custom_start = jdtls_lsp_start,
107 - name = 'jdtls',
108 108 filetypes = 'java',
109 109 command = create_jdtls_command(true),
110 110 root_dir = project.find_java_project_root,

neovim/lua/bugabinga/lsp/init.lua

Modified
11 11 local lsp_client_configs = require 'bugabinga.lsp.clients'
12 12 local _ = {}
14 - local token_update = function ( lsp_client )
15 - local token = lsp_client.data.token
16 - local buffer = lsp_client.buffer
17 - local client_id = lsp_client.data.client_id
18 - local mutable_variable_highlight = 'MutableVariable'
14 +local token_update = function ( lsp_client )
15 + local token = lsp_client.data.token
16 + local buffer = lsp_client.buffer
17 + local client_id = lsp_client.data.client_id
18 + local mutable_variable_highlight = 'MutableVariable'
20 - if token.type == 'variable' and not token.modifiers.readonly then
21 - vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
22 - end
24 - --TODO: find more use cases for semantic tokens
25 - --* global variables
26 - --* functions with side effects
27 - --* closures that capture something
20 + if token.type == 'variable' and not token.modifiers.readonly then
21 + vim.lsp.semantic_tokens.highlight_token( token, buffer, client_id, mutable_variable_highlight )
30 - local expand_path = function ( path )
31 - if vim.fn.executable( path ) == 1 then
32 - return vim.fn.exepath( path )
33 - else
34 - return path
35 - end
24 + --TODO: find more use cases for semantic tokens
25 + --* global variables
26 + --* functions with side effects
27 + --* closures that capture something
28 +end
30 +local expand_path = function ( path )
31 + if vim.fn.executable( path ) == 1 then
32 + return vim.fn.exepath( path )
33 + else
34 + return path
35 + end
36 +end
38 +local expand_command = function ( command )
39 + vim.validate { command = { command, { 'string', 'table' } } }
41 + -- vim.print( 'expanding command', command )
43 + if type( command ) == 'table' then
44 + command[1] = expand_path( command[1] )
45 + return command
38 - local expand_command = function ( command )
39 - vim.validate { command = { command, { 'string', 'table' } } }
48 + return expand_path( command )
49 +end
41 - -- vim.print( 'expanding command', command )
51 +local lsp_start = function ( file_type_event )
52 + -- vim.print("LSP START", file_type_event)
43 - if type( command ) == 'table' then
44 - command[1] = expand_path( command[1] )
45 - return command
46 - end
54 + local match = file_type_event.match
48 - return expand_path( command )
49 - end
56 + local matches_to_ignore = ignored.filetypes
57 + -- vim.print('filetypes to ignore', matches_to_ignore)
58 + if vim.iter( matches_to_ignore ):find( match ) then return end
51 - local lsp_start = function ( file_type_event )
52 - -- vim.print("LSP START", file_type_event)
60 + local bufnr = file_type_event.buf
61 + local buffer_path = vim.api.nvim_buf_get_name( bufnr )
54 - local match = file_type_event.match
63 + -- vim.print( "SEARCHING LSP CLIENT FOR:", match, buffer_path)
56 - local matches_to_ignore = ignored.filetypes
57 - -- vim.print('filetypes to ignore', matches_to_ignore)
58 - if vim.iter( matches_to_ignore ):find( match ) then return end
60 - local bufnr = file_type_event.buf
61 - local buffer_path = vim.api.nvim_buf_get_name( bufnr )
63 - -- vim.print( "SEARCHING LSP CLIENT FOR:", match, buffer_path)
65 - local potential_client_configs = vim.iter( lsp_client_configs )
66 - :map( function ( config )
67 - vim.validate {
68 - ['config'] = { config, 'table' },
69 - ['config.name'] = { config.name, 'string' },
70 - ['config.filetypes'] = { config.filetypes, { 'string', 'table' } },
71 - ['config.command'] = { config.command, { 'string', 'table' } },
72 - ['config.environment'] = { config.environment, 'table', true },
73 - ['config.root_dir'] = { config.root_dir, 'function', 'string' },
74 - ['config.single_file_support'] = { config.single_file_support, 'boolean', true },
75 - ['config.settings'] = { config.settings, 'table', true },
76 - ['config.workspaces'] = { config.workspaces, 'boolean', true },
77 - ['config.before_init'] = { config.before_init, 'function', true },
78 - ['config.init_options'] = { config.init_options, 'table', true },
79 - ['config.capabilities'] = { config.capabilities, 'table', true },
80 - ['config.custom_start'] = { config.custom_start, 'function', true },
81 - }
82 - -- normalize scalar values to its vector alternative for easier processing later on
83 - -- this mutates the lsp client configs! careful!
84 - config.command = type( config.command ) == 'string' and { expand_command( config.command ) } or
85 - expand_command( config.command )
86 - config.environment = config.environment or {}
87 - config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes } or config.filetypes
88 - config.single_file_support = config.single_file_support == nil and false or config.single_file_support
89 - config.workspaces = config.workspaces == nil and false or config.workspaces
90 - config.capabilities = config.capabilities or {}
91 - config.init_options = config.init_options or {}
93 - return config
94 - end )
95 - :filter( function ( config )
96 - return vim.iter( config.filetypes ):find( match )
97 - end )
98 - :totable()
100 - -- vim.print("POTENTIAL CLIENTS", vim.iter(potential_client_configs):map(function(config) return { name = config.name, command = config.command } end):totable())
102 - if table.is_empty( potential_client_configs ) then
103 - -- vim.notify( 'found no lsp client for', buffer_path )
104 - return
105 - end
107 - for _, config in ipairs( potential_client_configs ) do
108 - local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
109 - local capabilities = vim.lsp.protocol.make_client_capabilities()
110 - local cmp_capabilities = want 'cmp_nvim_lsp' ( function ( cmp )
111 - return cmp.default_capabilities()
112 - end, {} )
113 - capabilities = table.extend( 'force', capabilities, cmp_capabilities, config.capabilities )
114 - -- vim.print( 'lsp capabilities', capabilities, config.capabilities, cmp_capabilities )
116 - local start_config = {
117 - cmd = config.command,
118 - cmd_cwd = root_dir,
119 - -- cmd_env = config.environment,
120 - detached = false, -- do i want this?
121 - -- 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?
122 - capabilities = capabilities,
123 - -- handlers = vim.lsp.handlers,
124 - settings = config.settings,
125 - -- commands = nil, -- what is this?
126 - init_options = config.init_options,
127 - name = config.name,
128 - -- get_language_id = nil,
129 - -- offset_encoding = nil,
130 - on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
131 - before_init = config.before_init,
132 - -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
133 - -- on_exit = function(code, signal, client_id) vim.print("LSP CLIENT EXIT", code, signal, client_id) end,
134 - -- on_attach = function(client, bufnr) vim.print("LSP CLIENT ATTACH", client.data.client_id, bufnr) end,
135 - trace = 'off',
136 - flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200 },
137 - root_dir = root_dir,
65 + local potential_client_configs = vim.iter( lsp_client_configs )
66 + :map( function ( config )
67 + vim.validate {
68 + ['config'] = { config, 'table' },
69 + ['config.name'] = { config.name, 'string' },
70 + ['config.filetypes'] = { config.filetypes, { 'string', 'table' } },
71 + ['config.command'] = { config.command, { 'string', 'table' } },
72 + ['config.environment'] = { config.environment, 'table', true },
73 + ['config.root_dir'] = { config.root_dir, 'function', 'string' },
74 + ['config.single_file_support'] = { config.single_file_support, 'boolean', true },
75 + ['config.settings'] = { config.settings, 'table', true },
76 + ['config.workspaces'] = { config.workspaces, 'boolean', true },
77 + ['config.before_init'] = { config.before_init, 'function', true },
78 + ['config.init_options'] = { config.init_options, 'table', true },
79 + ['config.capabilities'] = { config.capabilities, 'table', true },
80 + ['config.custom_start'] = { config.custom_start, 'function', true },
82 + -- normalize scalar values to its vector alternative for easier processing later on
83 + -- this mutates the lsp client configs! careful!
84 + config.command = type( config.command ) == 'string' and { expand_command( config.command ) } or
85 + expand_command( config.command )
86 + config.environment = config.environment or {}
87 + config.filetypes = type( config.filetypes ) == 'string' and { config.filetypes } or config.filetypes
88 + config.single_file_support = config.single_file_support == nil and false or config.single_file_support
89 + config.workspaces = config.workspaces == nil and false or config.workspaces
90 + config.capabilities = config.capabilities or {}
91 + config.init_options = config.init_options or {}
140 - local lsp_starter = config.custom_start or vim.lsp.start
93 + return config
94 + end )
95 + :filter( function ( config )
96 + return vim.iter( config.filetypes ):find( match )
97 + end )
98 + :totable()
142 - -- vim.print( 'starting lsp', start_config.name, root_dir )
100 + -- vim.print("POTENTIAL CLIENTS", vim.iter(potential_client_configs):map(function(config) return { name = config.name, command = config.command } end):totable())
144 - lsp_starter( start_config, {
145 - bufnr = bufnr,
146 - -- TODO: reuse if workspaces
147 - -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
148 - reuse_client = function ( existing_client, new_config )
149 - --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
150 - local same_name_and_root = existing_client.name == new_config.name and
151 - existing_client.workspace_folders[1] == new_config.root_dir;
152 - -- vim.print( 'resuing lsp client?', same_name_and_root )
153 - return same_name_and_root;
154 - end,
155 - } )
157 - -- vim.print("ATTACHING LSP CLIENT", client_id)
158 - end
102 + if table.is_empty( potential_client_configs ) then
103 + -- vim.notify( 'found no lsp client for', buffer_path )
104 + return
161 - local old_formatexpr
162 - local old_omnifunc
163 - local old_tagfunc
107 + for _, config in ipairs( potential_client_configs ) do
108 + local root_dir = type( config.root_dir ) == 'string' and config.root_dir or config.root_dir( buffer_path )
109 + local capabilities = vim.lsp.protocol.make_client_capabilities()
110 + local cmp_capabilities = want 'cmp_nvim_lsp' ( function ( cmp )
111 + return cmp.default_capabilities()
112 + end, {} )
113 + capabilities = table.extend( 'force', capabilities, cmp_capabilities, config.capabilities )
114 + -- vim.print( 'lsp capabilities', capabilities, config.capabilities, cmp_capabilities )
165 - local lsp_attach = function ( args )
166 - local bufnr = args.buf
167 - local client = vim.lsp.get_client_by_id( args.data.client_id )
168 - if not client then return end
116 + local start_config = {
117 + cmd = config.command,
118 + cmd_cwd = root_dir,
119 + -- cmd_env = config.environment,
120 + detached = false, -- do i want this?
121 + -- 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?
122 + capabilities = capabilities,
123 + -- handlers = vim.lsp.handlers,
124 + settings = config.settings,
125 + -- commands = nil, -- what is this?
126 + init_options = config.init_options,
127 + name = config.name,
128 + -- get_language_id = nil,
129 + -- offset_encoding = nil,
130 + on_error = function ( code, ... ) vim.print( 'LSP ERROR', code, ... ) end,
131 + before_init = config.before_init,
132 + -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
133 + -- on_exit = function(code, signal, client_id) vim.print("LSP CLIENT EXIT", code, signal, client_id) end,
134 + -- on_attach = function(client, bufnr) vim.print("LSP CLIENT ATTACH", client.data.client_id, bufnr) end,
135 + trace = 'off',
136 + flags = { allow_incremental_sync = true, debounce_text_changes = 250, exit_timeout = 200 },
137 + root_dir = root_dir,
170 - -- vim.print(client.server_capabilities)
140 + local lsp_starter = config.custom_start or vim.lsp.start
172 - if client.server_capabilities.definitionProvider then
173 - old_tagfunc = vim.bo[bufnr].tagfunc
174 - vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
175 - end
142 + -- vim.print( 'starting lsp', start_config.name, root_dir )
177 - if client.server_capabilities.documentFormattingProvider then
178 - old_formatexpr = vim.bo[bufnr].formatexpr
179 - vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:50})'
180 - end
144 + lsp_starter( start_config, {
145 + bufnr = bufnr,
146 + -- TODO: reuse if workspaces
147 + -- local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
148 + -- reuse_client = function ( existing_client, new_config )
149 + -- --TODO lsps with single file or worksopaces support do not need smame root dir. instead add_workspace_folder
150 + -- local same_name_and_root = existing_client.name == new_config.name and
151 + -- existing_client.workspace_folders[1] == new_config.root_dir;
152 + -- -- vim.print( 'resuing lsp client?', same_name_and_root )
153 + -- return same_name_and_root;
154 + -- end,
155 + } )
182 - if client.server_capabilities.completionProvider then
183 - old_omnifunc = vim.bo[bufnr].omnifunc
184 - vim.bo[bufnr].omnifunc = 'v:vim.lsp.omnifunc'
185 - end
157 + -- vim.print("ATTACHING LSP CLIENT", client_id)
158 + end
159 +end
187 - -- if client.server_capabilities.inlayHintProvider then
188 - -- TODO: how to prevent the UI from jittering
189 - -- vim.lsp.inlay_hint( bufnr, true )
190 - -- end
161 +local old_formatexpr
162 +local old_omnifunc
163 +local old_tagfunc
192 - -- TODO: create register/unregister abstraction for lsp features
193 - -- TODO: show available code actions as diagnostics (must be filtered)
194 - -- TODO: use nicer guis for lsp interactive features
195 - map.normal {
196 - description = 'Show available code actions on current line.',
197 - category = 'lsp',
198 - keys = '<c-1>',
199 - command = vim.lsp.buf.code_action,
200 - }
165 +local keybinds = {}
166 +local add = function ( keybind )
167 + table.insert( keybinds, keybind )
168 +end
202 - map.normal {
203 - description = 'Goto to definition of symbol under cursor.',
204 - category = 'lsp',
205 - keys = '<c-2>',
206 - command = vim.lsp.buf.definition,
207 - }
208 - map.normal {
209 - description = 'Goto to definition of symbol under cursor.',
210 - category = 'telescope',
211 - keys = '<c-2><c-2>',
212 - command = '<cmd>Telescope lsp_definitions<cr>',
213 - }
170 +local lsp_attach = function ( args )
171 + local bufnr = args.buf
172 + local client = vim.lsp.get_client_by_id( args.data.client_id )
173 + if not client then return end
175 + -- vim.print(client.server_capabilities)
177 + if client.server_capabilities.definitionProvider then
178 + old_tagfunc = vim.bo[bufnr].tagfunc
179 + vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
180 + end
182 + if client.server_capabilities.documentFormattingProvider then
183 + old_formatexpr = vim.bo[bufnr].formatexpr
184 + vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:50})'
185 + end
187 + if client.server_capabilities.completionProvider then
188 + old_omnifunc = vim.bo[bufnr].omnifunc
189 + vim.bo[bufnr].omnifunc = 'v:vim.lsp.omnifunc'
190 + end
215 192 if client.server_capabilities.documentHighlightProvider then
216 193 -- the timer has application lifetime. no need to close
237 - map.normal {
214 + -- if client.server_capabilities.inlayHintProvider then
215 + -- TODO: how to prevent the UI from jittering
216 + -- vim.lsp.inlay_hint( bufnr, true )
217 + -- end
219 + add(map.normal {
238 220 description = 'Format current buffer',
239 221 category = 'lsp',
222 + buffer = bufnr,
240 223 keys = '<c-s>',
224 + --TODO: save actions
241 225 command = vim.lsp.buf.format,
242 - }
226 + })
244 - map.normal {
228 + add(map.normal {
245 229 description = 'Show hover documentation above cursor.',
246 230 category = 'lsp',
247 - keys = '<c-0>',
231 + buffer = bufnr,
232 + keys = { 'K', '<leader>lk' },
248 233 command = vim.lsp.buf.hover,
249 - }
234 + })
251 - map.normal {
236 + add(map.normal {
237 + description = 'Show signature help under cursor.',
238 + category = 'lsp',
239 + buffer = bufnr,
240 + keys = '<leader>ls',
241 + command = vim.lsp.buf.signature_help,
242 + })
244 + add(map.normal {
245 + description = 'Show available code actions on current line.',
246 + category = 'lsp',
247 + buffer = bufnr,
248 + keys = '<leader>la',
249 + command = vim.lsp.buf.code_action,
250 + })
252 + add(map.normal {
253 + description = 'Goto to definition of symbol under cursor.',
254 + category = 'lsp',
255 + buffer = bufnr,
256 + keys = '<leader>ld',
257 + command = vim.lsp.buf.definition,
258 + })
260 + add(map.normal {
252 261 description = 'Show implementations of symbol under cursor.',
253 262 category = 'lsp',
254 - keys = '<c-4>',
263 + buffer = bufnr,
264 + keys = '<leader>li',
255 265 command = vim.lsp.buf.implementation,
256 - }
257 - map.normal {
258 - description = 'Show implementations of symbol under cursor.',
259 - category = 'telescope',
260 - keys = '<c-4><c-4>',
261 - command = '<cmd>Telescope lsp_implementations<cr>',
262 - }
266 + })
264 - map.normal {
268 + add(map.normal {
265 269 description = 'Show incoming calls of symbol under cursor.',
266 270 category = 'lsp',
267 - keys = '<c-5>',
271 + buffer = bufnr,
272 + keys = '<leader>lci',
268 273 command = vim.lsp.buf.incoming_calls,
269 - }
270 - map.normal {
271 - description = 'Show incoming calls of symbol under cursor.',
272 - category = 'telescope',
273 - keys = '<c-5><c-5>',
274 - command = '<cmd>Telescope lsp_incoming_calls<cr>',
275 - }
276 - map.normal {
274 + })
276 + add(map.normal {
277 277 description = 'Show outgoing calls of symbol under cursor.',
278 278 category = 'lsp',
279 - keys = '<c-s-5>',
279 + buffer = bufnr,
280 + keys = '<leader>lco',
280 281 command = vim.lsp.buf.outgoing_calls,
281 - }
282 - map.normal {
283 - description = 'Show outgoing calls of symbol under cursor.',
284 - category = 'telescope',
285 - keys = '<c-s-5><c-s-5>',
286 - command = '<cmd>Telescope lsp_outgoing_calls<cr>',
287 - }
282 + })
289 - map.normal {
284 + add(map.normal {
290 285 description = 'Show references of symbol under cursor.',
291 286 category = 'lsp',
292 - keys = '<c-6>',
287 + buffer = bufnr,
288 + keys = '<leader>lr',
293 289 command = vim.lsp.buf.references,
294 - }
295 - map.normal {
296 - description = 'Show references of symbol under cursor.',
297 - category = 'telescope',
298 - keys = '<c-6><c-6>',
299 - command = vim.lsp.buf.references,
300 - }
290 + })
302 - map.normal {
292 + add(map.normal {
303 293 description = 'Rename symbol under cursor.',
304 294 category = 'lsp',
305 - keys = '<c-9>',
295 + buffer = bufnr,
296 + keys = { '<f2>', '<leader>ln' },
306 297 command = vim.lsp.buf.rename,
307 - }
309 - map.normal {
310 - description = 'Show signature help under cursor.',
311 - category = 'lsp',
312 - keys = '<c-s-0>',
313 - command = vim.lsp.buf.signature_help,
314 - }
316 - map.normal {
317 - description = 'Show signature help under cursor.',
318 - category = 'telescope',
319 - keys = '<c-s-0><c-s-0>',
320 - command = '<cmd>Telescope lsp_signature_help<cr>',
321 - }
298 + })
324 301 local lsp_detach = function ( args )
339 316 if client.server_capabilities.completionProvider then
340 317 vim.bo[bufnr].omnifunc = old_omnifunc
320 + for _, keybind_delete in ipairs(keybinds) do
321 + keybind_delete()
322 + end
344 326 auto 'lsp' {
411 393 desc = 'Shows detailed information about running LSP clients.',
414 -return setmetatable( _, {} )
396 +return setmetatable( _, {} )

neovim/lua/bugabinga/mark.lua

Modified
68 68 -- Create the sign.
69 69 local sign_name = 'Marks_' .. mark
70 70 if not sign_cache[sign_name] then
71 - vim.fn.sign_define( sign_name, { text = mark, texthl = 'DiagnosticSignOk' } )
71 + vim.fn.sign_define( sign_name, { text = mark, texthl = 'GitSignsChange' } )
72 72 sign_cache[sign_name] = true
74 74 vim.fn.sign_place( id, sign_group_name, sign_name, bufnr, {

neovim/lua/bugabinga/nugu/init.lua

Modified
451 451 GitSignsDeleteVirtLnInLine { DiffText },
452 452 GitSignsVirtLnum { fg = LineNr.fg },
454 + WhichKey { fg = ui_important_global }, -- the key
455 + WhichKeyGroup { fg = ui_important_local }, -- a group
456 + WhichKeySeparator { fg = ui_minor }, -- the separator between the key and its label
457 + WhichKeyDesc { fg = ui_normal }, -- the label of the key
458 + WhichKeyFloat { NormalFloat }, -- Normal in the popup window
459 + WhichKeyBorder { FloatBorder }, -- Normal in the popup window
460 + WhichKeyValue { Comment }, -- used by plugins that provide values

neovim/lua/bugabinga/options/ui.lua

Modified
60 60 vim.opt.pumheight = 10
62 62 -- transparent popups and floating windows
63 -vim.opt.pumblend = 5
64 -vim.opt.winblend = 5
63 +vim.opt.pumblend = 8
64 +vim.opt.winblend = 8
66 66 vim.g.border_style = 'shadow'

neovim/lua/bugabinga/plugins/oil.lua

Modified
31 31 float = {
32 32 border = vim.g.border_style,
33 33 padding = 2,
34 - win_options = { winblend = 10 },
34 + win_options = { winblend = vim.o.winblend },
39 39 description = 'Open parent directory in buffer.',
40 40 category = 'files',
41 41 keys = '-',
42 - command = oil.open,
43 - -- command = oil.open_float,
42 + -- command = oil.open,
43 + command = oil.open_float,
45 45 end,
46 -}

neovim/lua/bugabinga/plugins/spectre.lua

Modified
1 +local map = require 'std.map'
1 3 require 'bugabinga.health'.add_dependency
3 5 name_of_executable = 'rg'
13 15 opts = {
14 16 live_update = true,
15 17 default = { replace = { cmd = 'oxi' } },
16 - mapping = {
17 - ['run_current_replace'] = {
18 - map = '<leader>r',
19 - cmd = function () require 'spectre.actions'.run_current_replace() end,
20 - desc = 'replace current line'
21 - },
22 - }
19 + config = function ( _, opts )
20 + local spectre = require 'spectre'
21 + spectre.setup( opts )
23 + map.normal {
24 + description = 'Open Spectre',
25 + category = 'search',
26 + keys = '<leader>s',
27 + command = function () spectre.open() end,
28 + }
30 + map.normal {
31 + description = 'Search current word',
32 + category = 'search',
33 + keys = '<leader>sw',
34 + command = function () spectre.open_visual { select_word = true } end,
35 + }
37 + map.visual {
38 + description = 'Search current word',
39 + category = 'search',
40 + keys = '<leader>sw',
41 + command = function () spectre.open_visual() end,
42 + }
44 + map.normal {
45 + description = 'Search on current file',
46 + category = 'search',
47 + keys = '<leader>sp',
48 + command = function () spectre.open_file_search { select_word = true } end,
49 + }
50 + end,

neovim/lua/bugabinga/plugins/toggleterm.lua

Modified
33 33 direction = 'float',
34 34 float_opts = {
35 35 border = vim.g.border_style,
36 - winblend = 10,
36 + winblend = vim.o.winblend,
38 38 size = function ( term )
39 39 if term.direction == 'horizontal' then
139 139 vim.cmd [[ command! Graphviz lua Graphviz() ]]

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
143 143 enable = true,
144 144 lookahead = true,
145 145 keymaps = {
146 - ['af'] = '@function.outer',
147 - ['if'] = '@function.inner',
146 + ['af'] = { query = '@function.outer', desc = 'Select outer function' },
147 + ['if'] = { query = '@function.inner', desc = 'Select inner function' },
149 - ['ac'] = '@class.outer',
150 - ['ic'] = '@class.inner',
149 + ['ac'] = { query = '@class.outer', desc = 'Select outer class' },
150 + ['ic'] = { query = '@class.inner' , desc = 'Select inner class' },
152 - ['at'] = '@comment.outer',
153 - ['it'] = '@comment.inner',
152 + ['at'] = { query = '@comment.outer' , desc = 'Select outer comment' },
155 154 ['as'] = { query = '@scope', query_group = 'locals', desc = 'Select language scope' },
157 156 selection_modes = {
158 - ['@parameter.outer'] = 'v', -- charwise
159 - ['@function.outer'] = 'V', -- linewise
160 - ['@class.outer'] = '<c-v>', -- blockwise
157 + ['@parameter.outer'] = 'v',
158 + ['@function.outer'] = 'v',
159 + ['@class.outer'] = '<c-v>',
161 160 ['@scope'] = 'V',
163 162 include_surroundig_whitespace = true,
166 165 swap = {
167 166 enable = true,
168 167 swap_next = {
169 - ['<leader>sn'] = '@parameter.inner',
168 + ['<leader>sn'] = { query = '@parameter.inner' , desc = 'Swap parameter with next' },
171 170 swap_previous = {
172 - ['<leader>sp'] = '@parameter.inner',
171 + ['<leader>sp'] = { query = '@parameter.inner' , desc = 'Swap parameter with previous' },
178 177 border = vim.g.border_style,
179 178 floating_preview_opts = {},
180 179 peek_definition_code = {
181 - ['<c-)>'] = '@function.outer',
182 - ['<c-a-)>'] = '@class.outer',
180 + ['<leader>lpf'] = { query = '@function.outer', desc = 'Peek definition of outer function.' },
181 + ['<leader>lpc'] = { query = '@class.outer', desc = 'Peek definition of outer class.' },
187 186 enable = true,
188 187 set_jumps = true,
189 188 goto_next = {
190 - [']f'] = '@function.outer',
191 - [']c'] = { query = '@class.outer', desc = 'Next class start' },
192 - [']s'] = { query = '@scope', query_group = 'locals', desc = 'Next scope' },
193 - [']i'] = '@conditional.outer',
194 - [']a'] = '@parameter.outer',
189 + [']f'] = { query = '@function.outer' , desc = 'Goto next funtion' },
190 + [']c'] = { query = '@class.outer', desc = 'Goto next class' },
191 + [']s'] = { query = '@scope', query_group = 'locals', desc = 'Goto next scope' },
192 + [']i'] = { query = '@conditional.outer' , desc = 'Goto next conditional' },
193 + [']a'] = { query = '@parameter.outer' , desc = 'Goto next parameter' },
196 195 goto_previous = {
197 - ['[f'] = '@function.outer',
198 - ['[c'] = { query = '@class.outer', desc = 'Previous class start' },
199 - ['[s'] = { query = '@scope', query_group = 'locals', desc = 'Previous scope' },
200 - ['[i'] = '@conditional.outer',
201 - ['[a'] = '@parameter.outer',
196 + ['[f'] = { query = '@function.outer' , desc = 'Goto previous function' },
197 + ['[c'] = { query = '@class.outer', desc = 'goto previous class' },
198 + ['[s'] = { query = '@scope', query_group = 'locals', desc = 'Goto previous scope' },
199 + ['[i'] = { query = '@conditional.outer' , desc = 'Goto previous conditional' },
200 + ['[a'] = { query = '@parameter.outer' , desc = 'Goto previous parameter' },
230 229 maintainers = { '@IndianBoy42' },

neovim/lua/bugabinga/plugins/whichkey.lua

Modified
19 19 window = {
20 20 border = vim.g.border_style,
21 - winblend = 42/2,
21 + winblend = vim.o.winblend,
23 23 disable = {
24 24 buftypes = ignored.buftypes,

neovim/lua/std/map.lua

Modified
32 32 local bind = function ( self, map )
33 33 vim.validate {
34 34 map = { map, 'table' },
35 - ['map.keys'] = { map.keys, 'string' },
35 + ['map.keys'] = { map.keys, { 'string', 'table' } },
36 36 ['map.command'] = { map.command, { 'function', 'string' } },
53 53 if vim.tbl_isempty( self.mode ) then self.mode[1] = available_modes.normal_visual_select_operator_pending end
54 - vim.keymap.set( self.mode, keys, command, options )
55 + if type( keys ) == 'table' then
56 + for _, key in ipairs( keys ) do
57 + vim.keymap.set( self.mode, key, command, options )
58 + end
59 + else
60 + vim.keymap.set( self.mode, keys, command, options )
61 + end
55 63 self.mode = {}
57 65 return function ()
58 66 local delete_options = options.buffer and { buffer = options.buffer } or {}
59 - vim.keymap.del( self.mode, keys, delete_options )
67 + if type( keys ) == 'table' then
68 + for _, key in ipairs( keys ) do
69 + vim.keymap.del( self.mode, key, delete_options )
70 + end
71 + else
72 + vim.keymap.del( self.mode, keys, delete_options )
73 + end

neovim/popo.xml

Added
new file mode 100644

No text changes.