updated neovim lsp config
parent
3b8ef2383f
commit
0af1d2ba9c
|
|
@ -37,8 +37,8 @@ cmp.setup({
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
-- { name = 'vsnip' }, -- For vsnip users.
|
|
||||||
{ name = 'luasnip' }, -- For luasnip users.
|
{ name = 'luasnip' }, -- For luasnip users.
|
||||||
|
-- { name = 'vsnip' }, -- For vsnip users.
|
||||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||||
-- { name = 'snippy' }, -- For snippy users.
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
}, {
|
}, {
|
||||||
|
|
|
||||||
|
|
@ -27,21 +27,31 @@ end
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
-- Comes with clang
|
-- Comes with clang
|
||||||
require'lspconfig'.clangd.setup{on_attach = on_attach, capabilities = capabilities}
|
vim.lsp.config('clangd', {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
vim.lsp.enable('clangd')
|
||||||
|
|
||||||
-- NPM: dockerfile-language-server-nodejs
|
-- NPM: dockerfile-language-server-nodejs
|
||||||
require'lspconfig'.dockerls.setup{capabilities = capabilities}
|
-- vim.lsp.config('dockerls', {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
-- })
|
||||||
|
-- vim.lsp.enable('dockerls')
|
||||||
|
|
||||||
-- Pacman: haskell-language-server
|
-- Pacman: haskell-language-server
|
||||||
-- AUR: haskell-language-server-bin
|
-- AUR: haskell-language-server-bin
|
||||||
-- GH: https://github.com/haskell/haskell-language-server
|
-- GH: https://github.com/haskell/haskell-language-server
|
||||||
require'lspconfig'.hls.setup{
|
-- vim.lsp.config('hls', {
|
||||||
on_attach = on_attach,
|
-- on_attach = on_attach,
|
||||||
settings = {
|
-- settings = {
|
||||||
haskell = {
|
-- haskell = {
|
||||||
formattingProvider = "stylish-haskell"
|
-- formattingProvider = "stylish-haskell"
|
||||||
}
|
-- }
|
||||||
},
|
-- },
|
||||||
capabilities = capabilities
|
-- capabilities = capabilities
|
||||||
}
|
-- })
|
||||||
|
|
||||||
-- Pacman: vieter-vls (requires my Vieter repository)
|
-- Pacman: vieter-vls (requires my Vieter repository)
|
||||||
-- GH: https://github.com/vlang/vls
|
-- GH: https://github.com/vlang/vls
|
||||||
-- require'lspconfig'.vls.setup{
|
-- require'lspconfig'.vls.setup{
|
||||||
|
|
@ -49,19 +59,42 @@ require'lspconfig'.hls.setup{
|
||||||
-- filetypes = {'v'},
|
-- filetypes = {'v'},
|
||||||
-- on_attach = on_attach
|
-- on_attach = on_attach
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
-- Pacman: rust-analyzer
|
-- Pacman: rust-analyzer
|
||||||
-- GH: https://github.com/rust-analyzer/rust-analyzer
|
-- GH: https://github.com/rust-analyzer/rust-analyzer
|
||||||
require'lspconfig'.rust_analyzer.setup{on_attach = on_attach, capabilities = capabilities}
|
vim.lsp.config('rust_analyzer', {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
vim.lsp.enable('rust_analyzer')
|
||||||
|
|
||||||
-- Installed using R shell:
|
-- Installed using R shell:
|
||||||
-- `install.packages('languageserver')`
|
-- `install.packages('languageserver')`
|
||||||
-- GH: https://github.com/REditorSupport/languageserver
|
-- GH: https://github.com/REditorSupport/languageserver
|
||||||
require'lspconfig'.r_language_server.setup{capabilities = capabilities}
|
-- vim.lsp.config('r_language_server', {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
-- })
|
||||||
|
|
||||||
-- Installed using Go CLI:
|
-- Installed using Go CLI:
|
||||||
-- go install github.com/nametake/golangci-lint-langserver@latest
|
-- go install github.com/nametake/golangci-lint-langserver@latest
|
||||||
-- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
-- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||||
require'lspconfig'.gopls.setup{on_attach = on_attach, capabilities = capabilities}
|
vim.lsp.config('gopls', {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
vim.lsp.enable('gopls')
|
||||||
|
|
||||||
require'lspconfig'.texlab.setup{on_attach = on_attach, capabilities = capabilities}
|
vim.lsp.config('texlab', {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
vim.lsp.enable('texlab')
|
||||||
|
|
||||||
|
vim.lsp.config('ltex_plus', {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
vim.lsp.enable('ltex_plus')
|
||||||
|
|
||||||
-- Fix that stops rust-analyzer interrupting typing when a request is cancelled
|
-- Fix that stops rust-analyzer interrupting typing when a request is cancelled
|
||||||
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
|
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
local ls = require("luasnip")
|
||||||
|
|
||||||
|
-- Load my global snippets
|
||||||
|
require("luasnip.loaders.from_snipmate").lazy_load({paths = "~/.config/nvim/snippets"})
|
||||||
|
|
||||||
|
-- vim.keymap.set({"i", "s"}, "<Tab>", function() ls.jump( 1) end, {silent = true})
|
||||||
|
-- vim.keymap.set({"i", "s"}, "<S-Tab>", function() ls.jump(-1) end, {silent = true})
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
require"nvim-treesitter.configs".setup {
|
require"nvim-treesitter".setup {
|
||||||
highlight = { enable = true }
|
highlight = { enable = true }
|
||||||
}
|
}
|
||||||
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
-- local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
||||||
parser_config.v = {}
|
-- parser_config.v = {}
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = { 'rust', 'go' },
|
||||||
|
callback = function()
|
||||||
|
vim.wo.foldmethod = "expr"
|
||||||
|
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||||
|
vim.opt.foldtext = ""
|
||||||
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ require('pckr').add{
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
branch = 'main',
|
||||||
run = ":TSUpdate",
|
run = ":TSUpdate",
|
||||||
config = function()
|
config = function()
|
||||||
require("config.treesitter")
|
require("config.treesitter")
|
||||||
|
|
@ -94,8 +95,19 @@ require('pckr').add{
|
||||||
-- "ms-jpq/coq_nvim",
|
-- "ms-jpq/coq_nvim",
|
||||||
-- config = "config.coq"
|
-- config = "config.coq"
|
||||||
-- },
|
-- },
|
||||||
"L3MON4D3/LuaSnip",
|
{
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"L3MON4D3/LuaSnip",
|
||||||
|
config = function()
|
||||||
|
require('config.luasnip')
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
requires = {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
"L3MON4D3/LuaSnip"
|
||||||
|
}
|
||||||
|
},
|
||||||
"godlygeek/tabular"
|
"godlygeek/tabular"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,3 +57,12 @@ o.shelltemp = false
|
||||||
-- o.completeopt = "menuone,noselect"
|
-- o.completeopt = "menuone,noselect"
|
||||||
vim.cmd([[autocmd BufRead,BufNewFile *.v,*.vsh setlocal filetype=v]])
|
vim.cmd([[autocmd BufRead,BufNewFile *.v,*.vsh setlocal filetype=v]])
|
||||||
-- vim.cmd([[autocmd BufWritePre *.go,*.rs lua vim.lsp.buf.format()]])
|
-- vim.cmd([[autocmd BufWritePre *.go,*.rs lua vim.lsp.buf.format()]])
|
||||||
|
|
||||||
|
-- Configure ripgrep as the grep utility if present
|
||||||
|
if vim.fn.executable('rg') == 1 then
|
||||||
|
o.grepprg="rg --vimgrep --hidden --smart-case --no-heading"
|
||||||
|
|
||||||
|
-- Lets Vim understand the ripgrep output better for the location/quickfix
|
||||||
|
-- list
|
||||||
|
-- o.grepformat = o.grepformat .. "%f:%l:%c:%m"
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
snippet fn "Function definition"
|
||||||
|
/// ${4}
|
||||||
|
fn ${1:function_name}(${2})${3} {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue