Skip to content

Commit

Permalink
fix(keymap): make all completion-related keymaps silent (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jint-lzxy authored Oct 26, 2023
1 parent 370bd64 commit 8e2ba70
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions lua/keymap/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,45 @@ local mapping = {}
function mapping.lsp(buf)
local map = {
-- LSP-related keymaps, ONLY effective in buffers with LSP(s) attached
["n|<leader>li"] = map_cr("LspInfo"):with_buffer(buf):with_desc("lsp: Info"),
["n|<leader>lr"] = map_cr("LspRestart"):with_buffer(buf):with_nowait():with_desc("lsp: Restart"),
["n|go"] = map_cr("SymbolsOutline"):with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev"):with_buffer(buf):with_desc("lsp: Prev diagnostic"),
["n|g]"] = map_cr("Lspsaga diagnostic_jump_next"):with_buffer(buf):with_desc("lsp: Next diagnostic"),
["n|<leader>li"] = map_cr("LspInfo"):with_silent():with_buffer(buf):with_desc("lsp: Info"),
["n|<leader>lr"] = map_cr("LspRestart"):with_silent():with_buffer(buf):with_nowait():with_desc("lsp: Restart"),
["n|go"] = map_cr("SymbolsOutline"):with_silent():with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Prev diagnostic"),
["n|g]"] = map_cr("Lspsaga diagnostic_jump_next")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Next diagnostic"),
["n|<leader>ld"] = map_cr("Lspsaga show_line_diagnostics ++unfocus")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Line diagnostic"),
["n|gs"] = map_callback(function()
vim.lsp.buf.signature_help()
end):with_desc("lsp: Signature help"),
["n|gr"] = map_cr("Lspsaga rename"):with_buffer(buf):with_desc("lsp: Rename in file range"),
["n|gR"] = map_cr("Lspsaga rename ++project"):with_buffer(buf):with_desc("lsp: Rename in project range"),
["n|K"] = map_cr("Lspsaga hover_doc"):with_buffer(buf):with_desc("lsp: Show doc"),
["nv|ga"] = map_cr("Lspsaga code_action"):with_buffer(buf):with_desc("lsp: Code action for cursor"),
["n|gd"] = map_cr("Glance definitions"):with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_cr("Glance references"):with_buffer(buf):with_desc("lsp: Show reference"),
["n|<leader>ci"] = map_cr("Lspsaga incoming_calls"):with_buffer(buf):with_desc("lsp: Show incoming calls"),
["n|<leader>co"] = map_cr("Lspsaga outgoing_calls"):with_buffer(buf):with_desc("lsp: Show outgoing calls"),
["n|gr"] = map_cr("Lspsaga rename"):with_silent():with_buffer(buf):with_desc("lsp: Rename in file range"),
["n|gR"] = map_cr("Lspsaga rename ++project")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Rename in project range"),
["n|K"] = map_cr("Lspsaga hover_doc"):with_silent():with_buffer(buf):with_desc("lsp: Show doc"),
["nv|ga"] = map_cr("Lspsaga code_action")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Code action for cursor"),
["n|gd"] = map_cr("Glance definitions"):with_silent():with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_silent():with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_cr("Glance references"):with_silent():with_buffer(buf):with_desc("lsp: Show reference"),
["n|<leader>ci"] = map_cr("Lspsaga incoming_calls")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Show incoming calls"),
["n|<leader>co"] = map_cr("Lspsaga outgoing_calls")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Show outgoing calls"),
}
bind.nvim_load_mapping(map)

Expand Down

0 comments on commit 8e2ba70

Please sign in to comment.