Add some useful bindings
This commit is contained in:
parent
3a13cbc38d
commit
a199c64f28
2 changed files with 5 additions and 1 deletions
|
@ -18,7 +18,8 @@ local on_attach = function(_, bufnr)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-a>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'i', '<C-a>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
|
|
@ -10,6 +10,7 @@ local has_words_before = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
local packer = require'packer'
|
local packer = require'packer'
|
||||||
|
|
||||||
packer.startup(function()
|
packer.startup(function()
|
||||||
local plugins = {
|
local plugins = {
|
||||||
'wbthomason/packer.nvim', -- neovim plugin manager
|
'wbthomason/packer.nvim', -- neovim plugin manager
|
||||||
|
@ -64,6 +65,7 @@ packer.startup(function()
|
||||||
|
|
||||||
'neovim/nvim-lspconfig', -- language server configuration helper
|
'neovim/nvim-lspconfig', -- language server configuration helper
|
||||||
'williamboman/nvim-lsp-installer', -- plugin containing installation commands for many language servers
|
'williamboman/nvim-lsp-installer', -- plugin containing installation commands for many language servers
|
||||||
|
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||||
'hrsh7th/cmp-nvim-lsp', -- add lsp to completion engine
|
'hrsh7th/cmp-nvim-lsp', -- add lsp to completion engine
|
||||||
'hrsh7th/cmp-buffer', -- add buffer information to completion engine
|
'hrsh7th/cmp-buffer', -- add buffer information to completion engine
|
||||||
'hrsh7th/cmp-path', -- add filesystem information to complete enging
|
'hrsh7th/cmp-path', -- add filesystem information to complete enging
|
||||||
|
@ -115,6 +117,7 @@ packer.startup(function()
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
}, {
|
}, {
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
|
|
Reference in a new issue