mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nvim: prevent lsp from overriding some ftplugin bindings
This commit is contained in:
parent
c9c2b84413
commit
e7f4595b52
1 changed files with 4 additions and 2 deletions
|
|
@ -8,11 +8,13 @@ M.on_attach = function(client, bufnr)
|
|||
---@param bind string
|
||||
---@param cmd function | string
|
||||
---@param desc string
|
||||
local function nnoremap(bind, cmd, desc)
|
||||
---@param extraArgs? table
|
||||
local function nnoremap(bind, cmd, desc, extraArgs)
|
||||
local args = {
|
||||
buffer = bufnr,
|
||||
desc = "LSP: " .. desc,
|
||||
}
|
||||
args = vim.tbl_deep_extend("keep", args, extraArgs or {})
|
||||
vim.keymap.set("n", bind, cmd, args)
|
||||
end
|
||||
|
||||
|
|
@ -24,7 +26,7 @@ M.on_attach = function(client, bufnr)
|
|||
-- TODO: Maybe remove these or use the defaults?
|
||||
nnoremap("<leader>cl", vim.lsp.codelens.run, "run codelens")
|
||||
nnoremap("<leader>r", vim.lsp.buf.rename, "rename symbol")
|
||||
nnoremap("<leader>f", function() vim.lsp.buf.format { async = true } end, "format buffer")
|
||||
pcall(nnoremap, "<leader>f", function() vim.lsp.buf.format { async = true } end, "format buffer", { unique = true })
|
||||
|
||||
local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
|
||||
if
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue