Update neovim setup

Switch from pyright to python-lsp-server
This commit is contained in:
Sonny Bakker 2023-08-04 10:29:11 +02:00
parent 9891f205f4
commit b0cdf7b854
6 changed files with 47 additions and 38 deletions

View file

@ -16,7 +16,6 @@
- { domain: '{{ gitlab_domain }}', key: '{{ gitlab_host_key }}' }
roles:
- common
- npm
tasks:
- import_tasks: 'tasks/main.yml'
- import_tasks: 'tasks/dotfiles.yml'

View file

@ -20,25 +20,20 @@
version: '{{ item.version|default("HEAD") }}'
loop: '{{ neovim_plugins }}'
- name: install neovim python packages
pip:
name:
- neovim
- pynvim
extra_args: --user
- name: install neovim node package
become: true
npm:
name: neovim
global: true
# Note that the "python-lsp-server", "python-lsp-ruff" and "neovim" python
# packages should be installed to the corresponding virtualenv as well.
- name: install language servers
become: true
npm:
package:
name: '{{ item }}'
global: true
loop: '{{ language_servers + neovim_node_packages }}'
state: present
loop: '{{ language_servers }}'
- name: remove old neovim configuration file
file:

View file

@ -23,7 +23,9 @@ end
--enable some language servers with the additional completion capabilities
--offered by nvim-cmp
local servers = { 'ansiblels', 'yamlls', 'cssls', 'jsonls', 'tsserver', }
local servers = {
'ansiblels', 'yamlls', 'cssls', 'jsonls', 'tsserver', 'bashls', 'lua_ls'
}
--add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities()
@ -40,9 +42,19 @@ end
local util = require('lspconfig/util')
nvim_lsp.pyright.setup({
nvim_lsp.pylsp.setup({
on_attach = on_attach,
capabilities = capabilities,
cmd = { 'pylsp', '--verbose' },
settings = {
pylsp = {
plugins = {
ruff = {
enabled = true
}
}
}
},
root_dir = function(fname)
return util.root_pattern('.git', 'setup.cfg', 'requirements')(fname) or
util.path.dirname(fname)

View file

@ -21,8 +21,9 @@ vim.o.splitbelow = true
-- switch buffers without writing to file
vim.o.hidden = true
--fold indents
vim.o.foldmethod = 'indent'
-- folding
vim.o.foldmethod = 'expr'
vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
-- don't open folds when jumping over one with (, {, [[ or [{
vim.opt.foldopen = vim.opt.foldopen - { 'block' }
@ -56,3 +57,6 @@ vim.o.background = 'light'
-- enable statusbar
vim.o.laststatus = 2
vim.o.statusline = ' %F %m%r%w %= %{hostname()} %{strlen(&ft)?&ft:"none"} %{(&bomb?",BOM":"")} %{&ff} %l/%L %c %P'
-- python interpreter
vim.g.python3_host_prog = './env/bin/python'

View file

@ -8,7 +8,7 @@ local tree_sitter_config = require('nvim-treesitter.configs')
tree_sitter_config.setup {
ensure_installed = {
'lua', 'yaml', 'bash', 'python', 'javascript', 'css', 'scss', 'html',
'json', 'dockerfile', 'markdown',
'htmldjango', 'json', 'dockerfile', 'markdown',
},
auto_install = true,
highlight = {

View file

@ -57,16 +57,15 @@ neovim_plugins:
version: '0.1.x',
}
- { url: 'https://github.com/L3MON4D3/LuaSnip', name: 'luasnip', version: 'v1.0.0' }
neovim_node_packages:
- typescript
- { url: 'https://github.com/lewis6991/gitsigns.nvim', name: 'gitsigns.nvim' }
language_servers:
- pyright
- ansible-language-server
- yaml-language-server
- vscode-langservers-extracted
- typescript-language-server
- vscode-html-languageserver
- bash-language-server
- lua-language-server
python_download_url: 'https://www.python.org/ftp/python'
python_versions: