This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
forked from brainfucksec/neovim-lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvim-lspconfig.lua
62 lines (51 loc) · 2.27 KB
/
nvim-lspconfig.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
-----------------------------------------------------------
-- Neovim LSP configuration file
-----------------------------------------------------------
-- Plugin: nvim-lspconfig
-- url: https://github.com/neovim/nvim-lspconfig
-- url: https://github.com/williamboman/nvim-lsp-installer
-- url: https://github.com/williamboman/mason-lspconfig.nvim
-- url: https://github.com/williamboman/mason.nvim
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local function buf_set_keymap(...) vim.api.nvim_set_keymap(...) end
local opts = { noremap=true, silent=true }
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', '<leader>lc', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', '<leader>ls', '<cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
buf_set_keymap('n', '<leader>lw', '<cmd>lua vim.lsp.buf.workspace_symbol()<CR>', opts)
buf_set_keymap('n', '<leader>lg', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', '<leader>ll', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', '<leader>lf', '<cmd>lua vim.lsp.buf.format()<CR>', opts)
buf_set_keymap('v', '<leader>lf', '<cmd>lua vim.lsp.buf.format()<CR>', opts)
local capabilities_tmp = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities_tmp.offsetEncoding = { "utf-16" }
require("mason").setup(
{
ui = {
icons = {
package_installed = "✓",
package_pending = "➜",
package_uninstalled = "✗"
}
}
}
)
-- enable the `mason-lspconfig` plugin
require("mason-lspconfig").setup()
require("mason-lspconfig").setup_handlers {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function (server_name) -- default handler (optional)
require("lspconfig")[server_name].setup{
capabilities = capabilities_tmp
}
end
-- Next, you can provide a dedicated handler for specific servers.
-- For example, a handler override for the `rust_analyzer`:
}
-- lspfuzzy
require('lspfuzzy').setup()