diff options
author | aktersnurra <grydholm@kth.se> | 2021-04-19 21:43:23 +0200 |
---|---|---|
committer | aktersnurra <grydholm@kth.se> | 2021-04-19 21:43:23 +0200 |
commit | 23b895222a16925d39d04d45dedbedec9db0c752 (patch) | |
tree | eb5759eed884c1ddcb32f1b702e55dc4521bf60e /.config/nvim/lua/_lsp | |
parent | 174cd547dc32bb6d50ab5da329ad1bc4d516c20a (diff) |
Updates to nvim
Diffstat (limited to '.config/nvim/lua/_lsp')
-rw-r--r-- | .config/nvim/lua/_lsp/bash-ls.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/docker-ls.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/init.lua | 68 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/json-ls.lua | 11 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/lua-ls.lua | 45 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/python-ls.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/vim-ls.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/_lsp/yaml-ls.lua | 4 |
8 files changed, 0 insertions, 138 deletions
diff --git a/.config/nvim/lua/_lsp/bash-ls.lua b/.config/nvim/lua/_lsp/bash-ls.lua deleted file mode 100644 index 7a12dc0..0000000 --- a/.config/nvim/lua/_lsp/bash-ls.lua +++ /dev/null @@ -1,2 +0,0 @@ --- npm i -g bash-language-server -require'lspconfig'.bashls.setup {on_attach = require'_lsp'.common_on_attach} diff --git a/.config/nvim/lua/_lsp/docker-ls.lua b/.config/nvim/lua/_lsp/docker-ls.lua deleted file mode 100644 index 878aa86..0000000 --- a/.config/nvim/lua/_lsp/docker-ls.lua +++ /dev/null @@ -1,2 +0,0 @@ --- npm install -g dockerfile-language-server-nodejs -require'lspconfig'.dockerls.setup {on_attach = require'_lsp'.common_on_attach} diff --git a/.config/nvim/lua/_lsp/init.lua b/.config/nvim/lua/_lsp/init.lua deleted file mode 100644 index 12ce36a..0000000 --- a/.config/nvim/lua/_lsp/init.lua +++ /dev/null @@ -1,68 +0,0 @@ --- TODO figure out why this don't work -vim.fn.sign_define("LspDiagnosticsSignError", { - texthl = "LspDiagnosticsSignError", - text = "", - numhl = "LspDiagnosticsSignError" -}) -vim.fn.sign_define("LspDiagnosticsSignWarning", { - texthl = "LspDiagnosticsSignWarning", - text = "", - numhl = "LspDiagnosticsSignWarning" -}) -vim.fn.sign_define("LspDiagnosticsSignInformation", { - texthl = "LspDiagnosticsSignInformation", - text = "", - numhl = "LspDiagnosticsSignInformation" -}) -vim.fn.sign_define("LspDiagnosticsSignHint", { - texthl = "LspDiagnosticsSignHint", - text = "", - numhl = "LspDiagnosticsSignHint" -}) - -vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>') -vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>') -vim.cmd('nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>') -vim.cmd('nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>') -vim.cmd('nnoremap <silent> ca :Lspsaga code_action<CR>') -vim.cmd('nnoremap <silent> K :Lspsaga hover_doc<CR>') --- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') -vim.cmd('nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>') -vim.cmd('nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>') --- scroll down hover doc or scroll in definition preview -vim.cmd('nnoremap <silent> <C-f> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<CR>') --- scroll up hover doc -vim.cmd('nnoremap <silent> <C-b> <cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<CR>') -vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') - ---[[ " autoformat -autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100) -autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100) -autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]] --- Java --- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR> - -local lsp_config = {} - -function lsp_config.common_on_attach(client, bufnr) - - -- Set autocommands conditional on server_capabilities - if client.resolved_capabilities.document_highlight then - vim.api.nvim_exec([[ - hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646 - hi LspReferenceText cterm=bold ctermbg=red guibg=#464646 - hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646 - augroup lsp_document_highlight - autocmd! * <buffer> - autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() - autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() - augroup END - ]], false) - end -end - --- Use a loop to conveniently both setup defined servers --- and map buffer local keybindings when the language server attaches --- local servers = {"pyright", "tsserver"} --- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end -return lsp_config diff --git a/.config/nvim/lua/_lsp/json-ls.lua b/.config/nvim/lua/_lsp/json-ls.lua deleted file mode 100644 index 4fbbeff..0000000 --- a/.config/nvim/lua/_lsp/json-ls.lua +++ /dev/null @@ -1,11 +0,0 @@ --- npm install -g vscode-json-languageserver -require'lspconfig'.jsonls.setup { - on_attach = require'_lsp'.common_on_attach, - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0}) - end - } - } -} diff --git a/.config/nvim/lua/_lsp/lua-ls.lua b/.config/nvim/lua/_lsp/lua-ls.lua deleted file mode 100644 index 5768e5d..0000000 --- a/.config/nvim/lua/_lsp/lua-ls.lua +++ /dev/null @@ -1,45 +0,0 @@ - -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) -USER = vim.fn.expand('$USER') - -local sumneko_root_path = "" -local sumneko_binary = "" - -if vim.fn.has("mac") == 1 then - sumneko_root_path = "/Users/" .. USER .. - "/.config/nvim/ls/lua-language-server" - sumneko_binary = "/Users/" .. USER .. - "/.config/nvim/ls/lua-language-server/bin/macOS/lua-language-server" -elseif vim.fn.has("unix") == 1 then - sumneko_root_path = "/home/" .. USER .. - "/.config/nvim/ls/lua-language-server" - sumneko_binary = "/home/" .. USER .. - "/.config/nvim/ls/lua-language-server/bin/Linux/lua-language-server" -else - print("Unsupported system for sumneko") -end - -require'lspconfig'.sumneko_lua.setup { - cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, - on_attach = require'_lsp'.common_on_attach, - 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 - } - } - } - } -} diff --git a/.config/nvim/lua/_lsp/python-ls.lua b/.config/nvim/lua/_lsp/python-ls.lua deleted file mode 100644 index d07f59b..0000000 --- a/.config/nvim/lua/_lsp/python-ls.lua +++ /dev/null @@ -1,4 +0,0 @@ --- npm i -g pyright -require'lspconfig'.pyright.setup{ - on_attach = require'_lsp'.common_on_attach, -} diff --git a/.config/nvim/lua/_lsp/vim-ls.lua b/.config/nvim/lua/_lsp/vim-ls.lua deleted file mode 100644 index 08039a3..0000000 --- a/.config/nvim/lua/_lsp/vim-ls.lua +++ /dev/null @@ -1,2 +0,0 @@ --- npm install -g vim-language-server -require'lspconfig'.vimls.setup {on_attach = require'_lsp'.common_on_attach} diff --git a/.config/nvim/lua/_lsp/yaml-ls.lua b/.config/nvim/lua/_lsp/yaml-ls.lua deleted file mode 100644 index e611572..0000000 --- a/.config/nvim/lua/_lsp/yaml-ls.lua +++ /dev/null @@ -1,4 +0,0 @@ --- npm install -g yaml-language-server -require'lspconfig'.yamlls.setup{ - -- on_attach = require'lsp'.common_on_attach, -} |