chg: Only do LSP related keybinds on LspAttach
This commit is contained in:
parent
8524170e28
commit
51ad9f4bdf
4 changed files with 28 additions and 5 deletions
|
@ -8,11 +8,6 @@ local opt = vim.opt
|
|||
g.mapleader = ','
|
||||
g.maplocalleader = ';'
|
||||
|
||||
-- Set K to hover and ,a to show code actions
|
||||
api.nvim_create_user_command("LspHover", "lua vim.lsp.buf.hover()", { nargs = '+' })
|
||||
opt.keywordprg = ":LspHover"
|
||||
map('n', '<leader>a', vim.lsp.buf.code_action, { remap = false })
|
||||
|
||||
-- Use ctrl-[hjkl] to select the active split!
|
||||
map('n', '<c-k>', ":wincmd k<cr>", { silent = true })
|
||||
map('n', '<c-j>', ":wincmd j<cr>", { silent = true })
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
local lspconfig = require('lspconfig')
|
||||
local map = vim.keymap.set
|
||||
|
||||
require 'lspconfig'.pyright.setup({
|
||||
settings = {
|
||||
|
@ -17,3 +18,12 @@ lspconfig.lua_ls.setup({
|
|||
},
|
||||
}
|
||||
})
|
||||
|
||||
-- Set ;k to hover and ;a to show code actions
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
map('n', '<localleader>k', vim.lsp.buf.hover, { remap = false })
|
||||
map('n', '<localleader>a', vim.lsp.buf.code_action, { remap = false })
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -11,3 +11,12 @@ local lspconfig = require('lspconfig')
|
|||
-- },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- Set ;k to hover and ;a to show code actions
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
map('n', '<localleader>k', vim.lsp.buf.hover, { remap = false })
|
||||
map('n', '<localleader>a', vim.lsp.buf.code_action, { remap = false })
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -11,3 +11,12 @@ local lspconfig = require('lspconfig')
|
|||
-- },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- Set ;k to hover and ;a to show code actions
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
map('n', '<localleader>k', vim.lsp.buf.hover, { remap = false })
|
||||
map('n', '<localleader>a', vim.lsp.buf.code_action, { remap = false })
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue