nvim: only set lsp keybindings per buffer

This commit is contained in:
chayleaf 2023-03-19 20:09:10 +07:00
parent 82c96d70cf
commit 3c2e6ab8b9

View file

@ -352,7 +352,9 @@
vim.api.nvim_buf_set_option bufnr "omnifunc" "v:lua.vim.lsp.omnifunc" _ vim.api.nvim_buf_set_option bufnr "omnifunc" "v:lua.vim.lsp.omnifunc" _
# Mappings. # Mappings.
# See `:help vim.lsp.*` for documentation on any of the below functions # See `:help vim.lsp.*` for documentation on any of the below functions
kmSetNs { keymapSetNs {
buffer = bufnr;
keys = {
"gD" = { "gD" = {
rhs = vim.lsp.buf.declaration; rhs = vim.lsp.buf.declaration;
desc = "Jumps to the declaration of the symbol under the cursor."; }; desc = "Jumps to the declaration of the symbol under the cursor."; };
@ -392,6 +394,7 @@
"<space>f" = { "<space>f" = {
rhs = DEFUN (vim.lsp.buf.format {async = true;}); rhs = DEFUN (vim.lsp.buf.format {async = true;});
desc = "Formats a buffer."; }; desc = "Formats a buffer."; };
};
} _ } _
]) ])
# LET rust_settings # LET rust_settings
@ -411,7 +414,7 @@
LETREC LETREC
# LETREC on_attach_rust # LETREC on_attach_rust
(on_attach_rust: client: bufnr: L [ (on_attach_rust: client: bufnr: L [
vim.api.nvim_create_user_command "RustAndroid" (opts: L [ vim.api.nvim_buf_create_user_command bufnr "RustAndroid" (opts: L [
vim.lsp.set_log_level "debug" _ vim.lsp.set_log_level "debug" _
(lsp "rust_analyzer").setup { (lsp "rust_analyzer").setup {
on_attach = on_attach_rust; on_attach = on_attach_rust;
@ -430,9 +433,9 @@
}; };
setupLsp = args: setupLsp' (if builtins.isString args then { name = args; } else args); setupLsp = args: setupLsp' (if builtins.isString args then { name = args; } else args);
in on_attach_rust: L [ in on_attach_rust: L [
# (vim.lsp.set_log_level "debug") # vim.lsp.set_log_level "debug" _
map setupLsp [
# see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md # see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
map setupLsp [
"bashls" "bashls"
"clangd" "clangd"
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md # https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md