feat: configure LSP in neovim
add LSP config in $XDG_CONFIG_HOME/nvim/lua/lsp add language servers: - clangd (C/C++) - jedi (Python)
This commit is contained in:
parent
8ec80d78f5
commit
32680ec340
@ -9,3 +9,9 @@ require("maps") -- ./lua/maps.lua
|
|||||||
require("statusline") -- ./lua/statusline.lua
|
require("statusline") -- ./lua/statusline.lua
|
||||||
|
|
||||||
require("polyjuice") -- colorscheme
|
require("polyjuice") -- colorscheme
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
require("lsp") -- ./lua/lsp/init.lua
|
||||||
|
require("lsp.maps") -- ./lua/lsp/maps.lua
|
||||||
|
require("lsp.c") -- ./lua/lsp/c.lua
|
||||||
|
require("lsp.python") -- ./lua/lsp/python.lua
|
||||||
|
6
.config/nvim/lua/lsp/c.lua
Normal file
6
.config/nvim/lua/lsp/c.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Tuesday May 18, 2021 12:08:51 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : clangd config file for lsp
|
||||||
|
|
||||||
|
require("lspconfig").clangd.setup {}
|
21
.config/nvim/lua/lsp/init.lua
Normal file
21
.config/nvim/lua/lsp/init.lua
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Tuesday May 18, 2021 12:08:51 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : neovim lsp config file
|
||||||
|
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignError",
|
||||||
|
{texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignWarning",
|
||||||
|
{texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignHint",
|
||||||
|
{texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignInformation",
|
||||||
|
{texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
|
||||||
|
)
|
39
.config/nvim/lua/lsp/lua.lua
Normal file
39
.config/nvim/lua/lsp/lua.lua
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Tuesday May 18, 2021 12:08:51 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : sumneko (lua) config file for lsp
|
||||||
|
|
||||||
|
local system_name = "Linux"
|
||||||
|
|
||||||
|
-- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use
|
||||||
|
local sumneko_root_path = vim.fn.stdpath('cache')..'/lspconfig/sumneko_lua/lua-language-server'
|
||||||
|
local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server"
|
||||||
|
|
||||||
|
require'lspconfig'.sumneko_lua.setup {
|
||||||
|
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT',
|
||||||
|
-- Setup your lua path
|
||||||
|
path = vim.split(package.path, ';'),
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = {'vim'},
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = {
|
||||||
|
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||||
|
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
11
.config/nvim/lua/lsp/maps.lua
Normal file
11
.config/nvim/lua/lsp/maps.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Tuesday May 18, 2021 12:08:51 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : neovim lsp mappings file
|
||||||
|
|
||||||
|
utils = require("utils")
|
||||||
|
|
||||||
|
utils.map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
|
||||||
|
utils.map("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>")
|
||||||
|
utils.map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>")
|
||||||
|
utils.map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>")
|
6
.config/nvim/lua/lsp/python.lua
Normal file
6
.config/nvim/lua/lsp/python.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
-- Author : swytch
|
||||||
|
-- Created : Tuesday May 18, 2021 15:03:43 CET
|
||||||
|
-- License : GPLv3
|
||||||
|
-- Description : jedi (python) config file for lsp
|
||||||
|
|
||||||
|
require("lspconfig").jedi_language_server.setup{}
|
@ -35,6 +35,9 @@ return require("packer").startup(function()
|
|||||||
cmd = {"Telescope"}
|
cmd = {"Telescope"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
use "neovim/nvim-lspconfig"
|
||||||
|
|
||||||
-- display colors directly in editor
|
-- display colors directly in editor
|
||||||
use {
|
use {
|
||||||
"norcalli/nvim-colorizer.lua",
|
"norcalli/nvim-colorizer.lua",
|
||||||
|
@ -36,6 +36,7 @@ o.background = "dark"
|
|||||||
o.shortmess = o.shortmess .. "c"
|
o.shortmess = o.shortmess .. "c"
|
||||||
w.number = true
|
w.number = true
|
||||||
w.relativenumber = true
|
w.relativenumber = true
|
||||||
|
w.signcolumn = "yes"
|
||||||
o.listchars = "tab:<->,nbsp:␣,trail:·,extends:>,precedes:<"
|
o.listchars = "tab:<->,nbsp:␣,trail:·,extends:>,precedes:<"
|
||||||
o.showmatch = true
|
o.showmatch = true
|
||||||
o.ignorecase = true
|
o.ignorecase = true
|
||||||
|
@ -16,6 +16,7 @@ binutils
|
|||||||
bison
|
bison
|
||||||
capitaine-cursors
|
capitaine-cursors
|
||||||
cdparanoia
|
cdparanoia
|
||||||
|
clang
|
||||||
cmake
|
cmake
|
||||||
cronie
|
cronie
|
||||||
dash
|
dash
|
||||||
@ -40,6 +41,7 @@ iftop
|
|||||||
imagemagick
|
imagemagick
|
||||||
isync
|
isync
|
||||||
iwd
|
iwd
|
||||||
|
jedi-language-server
|
||||||
libnotify
|
libnotify
|
||||||
libtool
|
libtool
|
||||||
linux
|
linux
|
||||||
|
Reference in New Issue
Block a user