dotfiles
bugabingas dorkfiles
owned by bugabinga
neovim: new delete api for keymap (WIP)
710da9053c38d9fefc70491b7f518bef8681ede1
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Changed files (6)
neovim/lua/bugabinga/lsp/clients/lua.lua
Modified52 52 workspace
= {
checkThirdParty =
false, }
55 - before_init = function(
...)
56 - local before_init_arguments
= {
... }
57 - want
'neodev'(
function(neodev)
58 - return neodev.before_init(
unpack(before_init_arguments))
55 + before_init
= require"neodev.lsp".before_init,
neovim/lua/bugabinga/lsp/init.lua
Modified 8 6 local map
= require'std.keymap' 9 7 local auto
= require'std.auto' 35 32 local lsp_start = function(file_type_event)
37 33 local match
= file_type_event.match
39 35 local matches_to_ignore
= ignored.filetypes
61 57 [
'config.before_init']
= { config.before_init,
'function',
true},
65 61 config.command
= type(config.command)
== 'string' and { config.command }
or config.command
66 62 config.filetypes
= type(config.filetypes)
== 'string' and { config.filetypes }
or config.filetypes
116 112 root_dir
= config.root_dir(buffer_path),
120 115 local client_id
= vim.lsp.start(start_config, {
125 +local old_formatexpr
131 -local lsp_attach = function(
...)
132 +local lsp_attach = function(args)
133 + local bufnr
= args.buf
134 + local client
= vim.lsp.get_client_by_id(args.data.client_id)
135 + if not client
then return end 139 + if client.server_capabilities.definitionProvider
then 140 + old_tagfunc
= vim.bo[bufnr].tagfunc
141 + vim.bo[bufnr].tagfunc
= "v:lua.vim.lsp.tagfunc" 144 + if client.server_capabilities.documentFormattingProvider
then 145 + old_formatexpr
= vim.bo[bufnr].formatexpr
146 + vim.bo[bufnr].formatexpr
= "v:lua.vim.lsp.formatexpr(#{timeout_ms:50})" 149 + if client.server_capabilities.completionProvider
then 150 + old_omnifunc
= vim.bo[bufnr].omnifunc
151 + vim.bo[bufnr].omnifunc
= "v:vim.lsp.omnifunc" 158 + name =
'Show available code actions on current line.',
161 + command = vim.lsp.buf.code_action,
165 + name =
'Goto to definition of symbol under cursor.',
168 + command = vim.lsp.buf.definition,
171 + name =
'Goto to definition of symbol under cursor.',
172 + category =
'telescope',
173 + keys =
'<c-2><c-2>',
174 + command =
'<cmd>Telescope lsp_definitions<cr>',
177 + if client.server_capabilities.documentHighlightProvider
then 178 + auto
'document_highlight' {
180 + description =
'Highlight symbol under cursor on hold',
181 + events =
'CursorHold',
182 + pattern =
'<buffer>',
183 + command = vim.lsp.buf.document_highlight,
187 + description =
'Remove highlight from symbol under cursor on move',
188 + events = {
'CursorMoved',
'InsertEnter' },
189 + pattern =
'<buffer>',
190 + command = vim.lsp.buf.clear_references,
198 + if client.server_capabilities.executeCommandProvider
then 209 + name =
'Format current buffer',
212 + command = vim.lsp.buf.format,
216 + name =
'Show hover documentation above cursor.',
219 + command = vim.lsp.buf.hover,
223 + name =
'Show implementations of symbol under cursor.',
226 + command = vim.lsp.buf.implementation,
229 + name =
'Show implementations of symbol under cursor.',
230 + category =
'telescope',
231 + keys =
'<c-4><c-4>',
232 + command =
'<cmd>Telescope lsp_implementations<cr>',
236 + name =
'Show incoming calls of symbol under cursor.',
239 + command = vim.lsp.buf.incoming_calls,
242 + name =
'Show incoming calls of symbol under cursor.',
243 + category =
'telescope',
244 + keys =
'<c-5><c-5>',
245 + command =
'<cmd>Telescope lsp_incoming_calls<cr>',
248 + name =
'Show outgoing calls of symbol under cursor.',
251 + command = vim.lsp.buf.outgoing_calls,
254 + name =
'Show outgoing calls of symbol under cursor.',
255 + category =
'telescope',
256 + keys =
'<c-s-5><c-s-5>',
257 + command =
'<cmd>Telescope lsp_outgoing_calls<cr>',
261 + name =
'Show references of symbol under cursor.',
264 + command = vim.lsp.buf.references,
267 + name =
'Show references of symbol under cursor.',
268 + category =
'telescope',
269 + keys =
'<c-6><c-6>',
270 + command = vim.lsp.buf.references,
274 + name =
'Rename symbol under cursor.',
277 + command = vim.lsp.buf.rename,
281 + name =
'Show signature help under cursor.',
284 + command = vim.lsp.buf.signature_help,
287 + name =
'Show signature help under cursor.',
288 + category =
'telescope',
289 + keys =
'<c-7><c-7>',
290 + command =
'<cmd>Telescope lsp_signature_help<cr>',
134 -local lsp_detach = function(
...)
295 +local lsp_detach = function(args)
299 + local bufnr
= args.buf
300 + local client
= vim.lsp.get_client_by_id(args.data.client_id)
301 + if not client
then return end 303 + if client.server_capabilities.definitionProvider
then 304 + vim.bo[bufnr].tagfunc
= old_tagfunc
307 + if client.server_capabilities.documentFormattingProvider
then 308 + vim.bo[bufnr].formatexpr
= old_formatexpr
311 + if client.server_capabilities.completionProvider
then 312 + vim.bo[bufnr].omnifunc
= old_omnifunc
161 341 local lsp_info = function(command)
162 342 local all_or_current
= command.args
and command.args
== 'all' and {}
or {
bufnr =
0 }
163 - local active_clients
= vim.lsp.get_active_clients(all_or_current)
343 + local active_clients
= vim.lsp.get_clients(all_or_current)
165 345 local infos
= vim.iter(active_clients)
166 346 :map(
function(client)
189 369 local lsp_info_extended = function(command)
190 370 local all_or_current
= command.args
and command.args
== 'all' and {}
or {
bufnr =
0 }
191 - local active_clients
= vim.lsp.get_active_clients(all_or_current)
371 + local active_clients
= vim.lsp.get_clients(all_or_current)
192 372 ui.show_tree(active_clients)
neovim/lua/bugabinga/nugu/init.lua
Modified173 173 DiagnosticSignHint { DiagnosticHint },
174 174 DiagnosticSignOk { DiagnosticOk },
176 - LspReferenceText { Search },
177 - LspReferenceRead { Search },
178 - LspReferenceWrite { IncSearch },
176 + LspReferenceText {
bg = content_unfocus },
177 + LspReferenceRead { LspReferenceText },
178 + LspReferenceWrite { LspReferenceText },
181 181 Hlargs {
fg = ui_important_local,
gui =
'bold underdotted' },
neovim/lua/std/icon.lua
Modified11 11 checkbox_mark =
'',
12 12 checkbox_unmark =
'',
neovim/lua/std/ignored.lua
Modified10 10 'TelescopeResults',
neovim/lua/std/keymap.lua
Modified53 53 if vim.tbl_isempty(self.mode)
then self.mode[
1]
= available_modes.normal_visual_select_operator_pending
end 54 54 vim.keymap.set(self.mode, keys, command, options)
58 + local delete_options
= options.buffer
and {
buffer = options.buffer }
or {}
59 + vim.keymap.del(self.mode, keys, delete_options)
58 63 local add_mode = function(self, key)