Pure built-in lsp config finished (probably)
This commit is contained in:
parent
647cfeefb2
commit
6105bf7d42
4 changed files with 132 additions and 65 deletions
18
init.vim
18
init.vim
|
@ -11,25 +11,23 @@ Plug 'hrsh7th/cmp-buffer'
|
||||||
Plug 'hrsh7th/nvim-cmp'
|
Plug 'hrsh7th/nvim-cmp'
|
||||||
Plug 'williamboman/mason.nvim'
|
Plug 'williamboman/mason.nvim'
|
||||||
Plug 'williamboman/mason-lspconfig.nvim'
|
Plug 'williamboman/mason-lspconfig.nvim'
|
||||||
Plug 'jose-elias-alvarez/null-ls.nvim'
|
|
||||||
Plug 'mfussenegger/nvim-lint'
|
Plug 'mfussenegger/nvim-lint'
|
||||||
"Plug 'dense-analysis/ale'
|
"Plug 'dense-analysis/ale'
|
||||||
|
|
||||||
" various plugins
|
" various plugins
|
||||||
|
Plug 'airblade/vim-gitgutter'
|
||||||
Plug 'akinsho/bufferline.nvim', { 'tag': 'v3.*' }
|
Plug 'akinsho/bufferline.nvim', { 'tag': 'v3.*' }
|
||||||
Plug 'gorbit99/codewindow.nvim'
|
Plug 'gorbit99/codewindow.nvim'
|
||||||
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
|
|
||||||
Plug 'preservim/nerdcommenter'
|
Plug 'preservim/nerdcommenter'
|
||||||
Plug 'mhinz/vim-startify'
|
|
||||||
Plug 'rmagatti/auto-session'
|
Plug 'rmagatti/auto-session'
|
||||||
Plug 'tpope/vim-fugitive'
|
Plug 'tpope/vim-fugitive'
|
||||||
Plug 'Glench/Vim-Jinja2-Syntax'
|
Plug 'Glench/Vim-Jinja2-Syntax'
|
||||||
Plug 'vmware-archive/salt-vim'
|
Plug 'vmware-archive/salt-vim'
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
Plug 'honza/vim-snippets'
|
|
||||||
Plug 'itchyny/vim-cursorword'
|
Plug 'itchyny/vim-cursorword'
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
|
Plug 'f-person/git-blame.nvim'
|
||||||
|
|
||||||
" themes
|
" themes
|
||||||
Plug 'navarasu/onedark.nvim'
|
Plug 'navarasu/onedark.nvim'
|
||||||
|
@ -53,9 +51,9 @@ call plug#end()
|
||||||
set termguicolors
|
set termguicolors
|
||||||
|
|
||||||
" load main lua file with additional configs
|
" load main lua file with additional configs
|
||||||
|
lua require("general")
|
||||||
lua require("my-lspconfig")
|
lua require("my-lspconfig")
|
||||||
lua require("my-lint")
|
lua require("my-lint")
|
||||||
lua require("general")
|
|
||||||
|
|
||||||
" highlight all .conf files as apache config (:])
|
" highlight all .conf files as apache config (:])
|
||||||
autocmd BufEnter *.conf :setlocal filetype=apache
|
autocmd BufEnter *.conf :setlocal filetype=apache
|
||||||
|
@ -106,6 +104,16 @@ nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
||||||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||||
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
||||||
|
|
||||||
|
" gitgutter setup
|
||||||
|
let g:gitgutter_sign_added = '|'
|
||||||
|
let g:gitgutter_sign_modified = '|'
|
||||||
|
let g:gitgutter_sign_removed = '|'
|
||||||
|
let g:gitgutter_sign_removed_first_line = '|'
|
||||||
|
let g:gitgutter_sign_removed_above_and_below = '|'
|
||||||
|
let g:gitgutter_sign_modified_removed = '|'
|
||||||
|
let g:gitgutter_preview_win_floating = 1
|
||||||
|
nnoremap <C-g> <cmd>GitGutterPreviewHunk<cr>
|
||||||
|
|
||||||
" general configs
|
" general configs
|
||||||
set modeline
|
set modeline
|
||||||
let g:sls_use_jinja_syntax = 1
|
let g:sls_use_jinja_syntax = 1
|
||||||
|
|
|
@ -1,16 +1,27 @@
|
||||||
-- load lsp and dependencies (help for both coc and independent lsp setup)
|
-- load lsp and dependencies
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"bashls",
|
"bashls",
|
||||||
"pyright",
|
"pyright",
|
||||||
|
"pylsp",
|
||||||
|
--"pyre",
|
||||||
"perlnavigator",
|
"perlnavigator",
|
||||||
"salt_ls",
|
"salt_ls",
|
||||||
"dockerls",
|
"dockerls",
|
||||||
"kotlin_language_server",
|
"kotlin_language_server",
|
||||||
"intelephense",
|
"intelephense",
|
||||||
"phpactor",
|
"eslint",
|
||||||
"eslint"
|
"tsserver",
|
||||||
|
"markdownlint",
|
||||||
|
"cssls",
|
||||||
|
"cssmodules_ls",
|
||||||
|
"diagnosticls",
|
||||||
|
"jsonls",
|
||||||
|
"sumneko_lua",
|
||||||
|
"sqlls",
|
||||||
|
"yamlls",
|
||||||
|
"lemminx"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -28,21 +39,10 @@ codewindow.setup({
|
||||||
codewindow.apply_default_keybinds()
|
codewindow.apply_default_keybinds()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Set up nvim-cmp.
|
-- Set up nvim-cmp.
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
||||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
||||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
window = {
|
window = {
|
||||||
-- completion = cmp.config.window.bordered(),
|
-- completion = cmp.config.window.bordered(),
|
||||||
-- documentation = cmp.config.window.bordered(),
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
@ -92,14 +92,6 @@ cmp.setup.cmdline(':', {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set up lspconfig.
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
|
||||||
require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
|
||||||
capabilities = capabilities
|
|
||||||
}
|
|
||||||
|
|
||||||
require'lspconfig'.tsserver.setup{}
|
|
||||||
|
|
||||||
require("nvim-tree").setup({
|
require("nvim-tree").setup({
|
||||||
create_in_closed_folder = true,
|
create_in_closed_folder = true,
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
require('lint').linters_by_ft = {
|
require('lint').linters_by_ft = {
|
||||||
python = {'flake8', 'pylint', 'pycodestyle',}
|
python = {'flake8', 'pylint', 'pycodestyle', 'pydocstyle',},
|
||||||
|
php = {'phpcs'},
|
||||||
|
markdown = {'markdownlint'}
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "TextChanged" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
|
callback = function()
|
||||||
|
require("lint").try_lint()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
require("lint").try_lint()
|
require("lint").try_lint()
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -39,6 +39,14 @@ require'lspconfig'.pyright.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
|
require 'lspconfig'.pylsp.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
require 'lspconfig'.pyre.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
require 'lspconfig'.bashls.setup {
|
require 'lspconfig'.bashls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
@ -63,6 +71,10 @@ require'lspconfig'.eslint.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
|
require 'lspconfig'.tsserver.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
require 'lspconfig'.perlnavigator.setup {
|
require 'lspconfig'.perlnavigator.setup {
|
||||||
settings = {
|
settings = {
|
||||||
perlnavigator = {
|
perlnavigator = {
|
||||||
|
@ -77,3 +89,50 @@ require'lspconfig'.perlnavigator.setup{
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.cssls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.cssmodules_ls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.diagnosticls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.jsonls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.sumneko_lua.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { 'vim' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.sqlls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.yamlls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lspconfig'.lemminx.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue