Pure built-in lsp config finished (probably)

This commit is contained in:
Szwendacz99 2022-10-28 20:55:05 +02:00
parent 647cfeefb2
commit 6105bf7d42
4 changed files with 132 additions and 65 deletions

View file

@ -11,25 +11,23 @@ Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/nvim-cmp'
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'mfussenegger/nvim-lint'
"Plug 'dense-analysis/ale'
" various plugins
Plug 'airblade/vim-gitgutter'
Plug 'akinsho/bufferline.nvim', { 'tag': 'v3.*' }
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 'mhinz/vim-startify'
Plug 'rmagatti/auto-session'
Plug 'tpope/vim-fugitive'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'vmware-archive/salt-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'honza/vim-snippets'
Plug 'itchyny/vim-cursorword'
Plug 'sheerun/vim-polyglot'
Plug 'f-person/git-blame.nvim'
" themes
Plug 'navarasu/onedark.nvim'
@ -53,9 +51,9 @@ call plug#end()
set termguicolors
" load main lua file with additional configs
lua require("general")
lua require("my-lspconfig")
lua require("my-lint")
lua require("general")
" highlight all .conf files as apache config (:])
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>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
set modeline
let g:sls_use_jinja_syntax = 1

View file

@ -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-lspconfig").setup({
ensure_installed = {
"bashls",
"pyright",
"pylsp",
--"pyre",
"perlnavigator",
"salt_ls",
"dockerls",
"kotlin_language_server",
"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()
-- Set up nvim-cmp.
local cmp = require'cmp'
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 = {
-- completion = 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({
create_in_closed_folder = true,

View file

@ -1,8 +1,16 @@
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()
require("lint").try_lint()
end,

View file

@ -39,6 +39,14 @@ require'lspconfig'.pyright.setup{
on_attach = on_attach,
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 {
on_attach = on_attach,
capabilities = capabilities,
@ -63,6 +71,10 @@ require'lspconfig'.eslint.setup{
on_attach = on_attach,
capabilities = capabilities,
}
require 'lspconfig'.tsserver.setup {
on_attach = on_attach,
capabilities = capabilities,
}
require 'lspconfig'.perlnavigator.setup {
settings = {
perlnavigator = {
@ -77,3 +89,50 @@ require'lspconfig'.perlnavigator.setup{
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,
}