nvim: only set lsp keybindings per buffer
This commit is contained in:
parent
82c96d70cf
commit
3c2e6ab8b9
|
@ -352,46 +352,49 @@
|
||||||
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 {
|
||||||
"gD" = {
|
buffer = bufnr;
|
||||||
rhs = vim.lsp.buf.declaration;
|
keys = {
|
||||||
desc = "Jumps to the declaration of the symbol under the cursor."; };
|
"gD" = {
|
||||||
"gd" = {
|
rhs = vim.lsp.buf.declaration;
|
||||||
rhs = vim.lsp.buf.definition;
|
desc = "Jumps to the declaration of the symbol under the cursor."; };
|
||||||
desc = "Jumps to the definition of the symbol under the cursor."; };
|
"gd" = {
|
||||||
"K" = {
|
rhs = vim.lsp.buf.definition;
|
||||||
rhs = vim.lsp.buf.hover;
|
desc = "Jumps to the definition of the symbol under the cursor."; };
|
||||||
desc = "Displays hover information about the symbol under the cursor in a floating window."; };
|
"K" = {
|
||||||
"gi" = {
|
rhs = vim.lsp.buf.hover;
|
||||||
rhs = vim.lsp.buf.implementation;
|
desc = "Displays hover information about the symbol under the cursor in a floating window."; };
|
||||||
desc = "Lists all the implementations for the symbol under the cursor in the quickfix window."; };
|
"gi" = {
|
||||||
"<C-h>" = {
|
rhs = vim.lsp.buf.implementation;
|
||||||
rhs = vim.lsp.buf.signature_help;
|
desc = "Lists all the implementations for the symbol under the cursor in the quickfix window."; };
|
||||||
desc = "Displays signature information about the symbol under the cursor in a floating window."; };
|
"<C-h>" = {
|
||||||
"<space>wa" = {
|
rhs = vim.lsp.buf.signature_help;
|
||||||
rhs = vim.lsp.buf.add_workspace_folder;
|
desc = "Displays signature information about the symbol under the cursor in a floating window."; };
|
||||||
desc = "Add a folder to the workspace folders."; };
|
"<space>wa" = {
|
||||||
"<space>wr" = {
|
rhs = vim.lsp.buf.add_workspace_folder;
|
||||||
rhs = vim.lsp.buf.remove_workspace_folder;
|
desc = "Add a folder to the workspace folders."; };
|
||||||
desc = "Remove a folder from the workspace folders."; };
|
"<space>wr" = {
|
||||||
"<space>wl" = {
|
rhs = vim.lsp.buf.remove_workspace_folder;
|
||||||
rhs = DEFUN (print (CALL vim.inspect (CALL vim.lsp.buf.list_workspace_folders)));
|
desc = "Remove a folder from the workspace folders."; };
|
||||||
desc = "List workspace folders."; };
|
"<space>wl" = {
|
||||||
"<space>D" = {
|
rhs = DEFUN (print (CALL vim.inspect (CALL vim.lsp.buf.list_workspace_folders)));
|
||||||
rhs = vim.lsp.buf.type_definition;
|
desc = "List workspace folders."; };
|
||||||
desc = "Jumps to the definition of the type of the symbol under the cursor."; };
|
"<space>D" = {
|
||||||
"<space>rn" = {
|
rhs = vim.lsp.buf.type_definition;
|
||||||
rhs = vim.lsp.buf.rename;
|
desc = "Jumps to the definition of the type of the symbol under the cursor."; };
|
||||||
desc = "Rename old_fname to new_fname"; };
|
"<space>rn" = {
|
||||||
"<space>ca" = {
|
rhs = vim.lsp.buf.rename;
|
||||||
rhs = vim.lsp.buf.code_action;
|
desc = "Rename old_fname to new_fname"; };
|
||||||
desc = "Selects a code action available at the current cursor position."; };
|
"<space>ca" = {
|
||||||
"gr" = {
|
rhs = vim.lsp.buf.code_action;
|
||||||
rhs = vim.lsp.buf.references;
|
desc = "Selects a code action available at the current cursor position."; };
|
||||||
desc = "Lists all the references to the symbol under the cursor in the quickfix window."; };
|
"gr" = {
|
||||||
"<space>f" = {
|
rhs = vim.lsp.buf.references;
|
||||||
rhs = DEFUN (vim.lsp.buf.format {async = true;});
|
desc = "Lists all the references to the symbol under the cursor in the quickfix window."; };
|
||||||
desc = "Formats a buffer."; };
|
"<space>f" = {
|
||||||
|
rhs = DEFUN (vim.lsp.buf.format {async = true;});
|
||||||
|
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" _
|
||||||
|
# see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
map setupLsp [
|
map setupLsp [
|
||||||
# see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
|
||||||
"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
|
||||||
|
|
Loading…
Reference in a new issue