From 95c5cddab20ea54cbf7ed4bdfa84205ca14cc2c0 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 8 Oct 2025 20:54:10 +0200 Subject: [PATCH 1/5] Replace deprecated nvim_lsp usage --- templates/nvim/lua/lsp.lua.j2 | 38 ++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index 12e6684..1da3fdc 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -29,7 +29,7 @@ end --enable some language servers with the additional completion capabilities --offered by nvim-cmp -local servers = { +local auto_setup_servers = { {% for item in language_servers %} {% if item.auto_setup and not loop.last %} '{{ item.server_name }}', @@ -43,10 +43,8 @@ local servers = { local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) -local nvim_lsp = require('lspconfig') - -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { +for _, lsp in ipairs(auto_setup_servers) do + vim.lsp.config[lsp] = { on_attach = on_attach, capabilities = capabilities, } @@ -60,26 +58,26 @@ local python_root_dir = function(fname) util.path.dirname(fname) end -nvim_lsp.ruff.setup { +vim.lsp.config['ruff'] = { on_attach = on_attach, capabilities = capabilities, root_dir = python_root_dir } -nvim_lsp.pyright.setup { +vim.lsp.config['pyright'] = { settings = { pyright = { -- Using Ruff's import organizer - disableOrganizeImports = true, + disableOrganizeImports = true, }, - }, + } } local snippet_capabilities = vim.deepcopy(capabilities); snippet_capabilities.textDocument.completion.completionItem.snippetSupport = true -nvim_lsp.html.setup { +vim.lsp.config['html'] = { on_attach = on_attach, capabilities = snippet_capabilities, filetypes = { 'html', 'htmldjango' }, @@ -92,17 +90,17 @@ nvim_lsp.html.setup { } } -nvim_lsp.cssls.setup { +vim.lsp.config['cssls'] = { on_attach = on_attach, capabilities = snippet_capabilities, } -nvim_lsp.jsonls.setup { +vim.lsp.config['jsonls'] = { on_attach = on_attach, capabilities = snippet_capabilities, } -nvim_lsp.lua_ls.setup { +vim.lsp.config['lua_ls'] = { on_attach = on_attach, capabilities = snippet_capabilities, settings = { @@ -115,12 +113,24 @@ nvim_lsp.lua_ls.setup { } {% endif %} -nvim_lsp.yamlls.setup { +vim.lsp.config['yamlls'] = { on_attach = on_attach, capabilities = capabilities, filetypes = { 'yaml', 'yaml.ansible', 'yaml.docker-compose', 'yaml.gitlab' } } +local servers = { + {% for item in language_servers %} + {% if not loop.last %} + '{{ item.server_name }}', + {% else %} + '{{ item.server_name }}' + {% endif %} + {% endfor %} +} + +vim.lsp.enable { unpack(servers) } + local cmp = require('cmp') local luasnip = require('luasnip') From df438c062bee5620447fd90480edac4cc6b83288 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 8 Oct 2025 20:55:32 +0200 Subject: [PATCH 2/5] Add keybind to search with treesitter --- templates/nvim/lua/telescope.lua.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/nvim/lua/telescope.lua.j2 b/templates/nvim/lua/telescope.lua.j2 index d568703..bdc9842 100644 --- a/templates/nvim/lua/telescope.lua.j2 +++ b/templates/nvim/lua/telescope.lua.j2 @@ -23,6 +23,7 @@ vim.keymap.set('n', 'fj', builtin.jumplist, opts) vim.keymap.set('n', 'fl', builtin.loclist, opts) vim.keymap.set('n', 'fq', builtin.quickfix, opts) vim.keymap.set('n', 'fm', builtin.marks, opts) +vim.keymap.set('n', 'ft', builtin.treesitter, opts) telescope.setup({ defaults = { From bdf0af0645e5db49df1c017303302d04a6c9dbe1 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 8 Oct 2025 20:56:09 +0200 Subject: [PATCH 3/5] Fix colorscheme command --- templates/nvim/lua/colorscheme.lua.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/nvim/lua/colorscheme.lua.j2 b/templates/nvim/lua/colorscheme.lua.j2 index 4cbea41..067d136 100644 --- a/templates/nvim/lua/colorscheme.lua.j2 +++ b/templates/nvim/lua/colorscheme.lua.j2 @@ -29,7 +29,7 @@ Use the `Introspect` option to inspect available options: dbus-send \ --session \ ---print-reply ] +--print-reply \ --reply-timeout=2000 \ --type=method_call \ --dest=org.freedesktop.portal.Desktop \ From cca1f0e59d1ecc822832e8c8fd50c96e4c685012 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 8 Oct 2025 20:56:21 +0200 Subject: [PATCH 4/5] Move telescope prompt position --- templates/nvim/lua/telescope.lua.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/nvim/lua/telescope.lua.j2 b/templates/nvim/lua/telescope.lua.j2 index bdc9842..38a5adc 100644 --- a/templates/nvim/lua/telescope.lua.j2 +++ b/templates/nvim/lua/telescope.lua.j2 @@ -29,7 +29,7 @@ telescope.setup({ defaults = { layout_strategy = 'vertical', layout_config = { - prompt_position = 'top', + prompt_position = 'bottom', vertical = { width = 0.8, height = 0.9 } }, }, From 54d4fa4323a62c337e33345e1558df2792444f86 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 8 Oct 2025 21:00:15 +0200 Subject: [PATCH 5/5] Switch to master branch for nvim-treesitter The new main branch, which should be the default branch from now on, does not seem to be stable --- group_vars/all/neovim.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/group_vars/all/neovim.yml b/group_vars/all/neovim.yml index ae2f5d9..e67edd3 100644 --- a/group_vars/all/neovim.yml +++ b/group_vars/all/neovim.yml @@ -21,6 +21,7 @@ neovim_plugins: name: 'cmp-nvim-lua' - url: 'https://github.com/nvim-treesitter/nvim-treesitter' name: 'nvim-treesitter' + version: master # main seems broken? - url: 'https://github.com/nvim-lua/plenary.nvim' name: 'plenary.nvim' - url: 'https://github.com/nvim-telescope/telescope-fzf-native.nvim'