Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lsp = require('lspconfig')
- local completion = require('completion')
- local api = vim.api
- local configs = require('lspconfig/configs')
- --local functi
- --" Set completeopt to have a better completion experience
- api.nvim_command('set completeopt=longest,menuone,noinsert,noselect')
- --" Use <Tab> and <S-Tab> to navigate through popup menu
- api.nvim_command('inoremap <expr> <Tab> pumvisible() ? "<C-n>" : "<Tab>"')
- api.nvim_command('inoremap <expr> <S-Tab> pumvisible() ? "<C-p>" : "<S-Tab>"')
- --" Avoid showing message extra message when using completion
- api.nvim_command('set shortmess+=c')
- --api.nvim_command('')
- local mapper = function(mode, key, result)
- vim.api.nvim_buf_set_keymap(0, mode, key, "<cmd>lua "..result.."<cr>", {noremap = true, silent = true})
- end
- local custom_attach = function()
- completion.on_attach()
- -- Move cursor to the next and previous diagnostic
- mapper('n', '<leader>dn', 'vim.lsp.diagnostic.goto_next()')
- mapper('n', '<leader>dp', 'vim.lsp.diagnostic.goto_prev()')
- end
- lsp.pyls.setup{
- on_attach = custom_attach
- }
- lsp.tsserver.setup {on_attach = custom_attach}
- lsp.jdtls.setup {on_attach = custom_attach,
- root_dir = lsp.util.root_pattern('.git', 'pom.xml', 'build.xml')
- }
- lsp.sumneko_lua.setup {on_attach = custom_attach}
- --another lua config that does not work either
- --lsp.sumneko_lua.setup{
- --on_attach=custom_attach,
- --settings = {
- --Lua = {
- --runtime = { version = "LuaJIT", path = vim.split(package.path, ';'), },
- --completion = { keywordSnippet = "Enable", },
- --diagnostics = { enable = true, globals = {
- --"vim", "describe", "it", "before_each", "after_each" },
- --},
- --workspace = {
- --library = {
- --[vim.fn.expand("$VIMRUNTIME/lua")] = true,
- --[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
- --}
- --}
- --}
- --}
- --}
Advertisement
Add Comment
Please, Sign In to add comment