From 12297f538e556bb312a270439b1204d65bac156b Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 21 Mar 2025 09:00:22 +0100 Subject: [PATCH 01/29] Detect legacy formatters --- templates/nvim/lua/formatting.lua.j2 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/templates/nvim/lua/formatting.lua.j2 b/templates/nvim/lua/formatting.lua.j2 index 10c6332..36a4279 100644 --- a/templates/nvim/lua/formatting.lua.j2 +++ b/templates/nvim/lua/formatting.lua.j2 @@ -1,6 +1,18 @@ -- {{ ansible_managed }} local enable_formatting = vim.env.enable_formatting == 'true'; +local legacy_formatting = nil; + +-- TODO: move to utils file +-- TODO: add efm-languageserver to lsp.lua +if vim.env.VIRTUAL_ENV ~= nil and enable_formatting == true then + local formatters = vim.fs.find( + { 'isort', 'black' }, + { limit = 1, type = 'file', path = vim.fs.joinpath(vim.env.VIRTUAL_ENV, 'bin') } + ) + + legacy_formatting = #formatters > 0; +end if (enable_formatting) then vim.api.nvim_create_autocmd('LspAttach', { @@ -14,7 +26,10 @@ if (enable_formatting) then callback = function() vim.lsp.buf.format { async = false, - id = args.data.client_id + id = args.data.client_id, + filter = function(format_client) + return format_client.name ~= 'ruff' or not legacy_formatting + end } end, }) From 3b50e0ee67b09366cfbedf65c9d1c1df48a802ff Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 26 Mar 2025 10:16:52 +0100 Subject: [PATCH 02/29] Disable formatting for template strings --- templates/nvim/lua/lsp.lua.j2 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index 78fd62f..b324de2 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -83,6 +83,13 @@ nvim_lsp.html.setup { on_attach = on_attach, capabilities = snippet_capabilities, filetypes = { 'html', 'htmldjango' }, + settings = { + html = { + format = { + templating = true + } + } + } } nvim_lsp.cssls.setup { From a68558e4aef6e3127e8c5738c0539e1d1a5d6fcf Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 1 Apr 2025 22:14:38 +0200 Subject: [PATCH 03/29] Add tmux theme toggle configuration --- tasks/dotfiles.yml | 14 +++++++++++++- templates/tmux-toggle.j2 | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 templates/tmux-toggle.j2 diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index 44445b2..1d097f9 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -38,9 +38,15 @@ - src: '{{ ansible_env.HOME }}/dotfiles/.profile' dest: '{{ ansible_env.HOME }}/.profile' - - src: '{{ ansible_env.HOME }}/dotfiles/.tmux.conf' + - src: '{{ ansible_env.HOME }}/dotfiles/tmux/tmux.conf' dest: '{{ xdg_config_dir }}/tmux/tmux.conf' + - src: '{{ ansible_env.HOME }}/dotfiles/tmux/light.conf' + dest: '{{ xdg_config_dir }}/tmux/light.conf' + + - src: '{{ ansible_env.HOME }}/dotfiles/tmux/dark.conf' + dest: '{{ xdg_config_dir }}/tmux/dark.conf' + - src: '{{ ansible_env.HOME }}/dotfiles/.gitignore' dest: '{{ xdg_config_dir }}/git/ignore' @@ -49,3 +55,9 @@ src: 'templates/gitconfig.j2' dest: '{{ xdg_config_dir }}/git/config' mode: '0755' + +- name: Copy tmux toggle script + ansible.builtin.template: + src: 'templates/tmux-toggle.j2' + dest: '{{ ansible_env.HOME }}/.local/bin/tmux-toggle.sh' + mode: '0755' diff --git a/templates/tmux-toggle.j2 b/templates/tmux-toggle.j2 new file mode 100644 index 0000000..3a2bda6 --- /dev/null +++ b/templates/tmux-toggle.j2 @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +# +# {{ ansible_managed }} +# +# Toggle the current window (all panes) between light and dark themes. + +set -e + +current_window_style=$(tmux show -Av window-style) + +case $current_window_style in + 'fg=#000000,bg=#eff0f1') + tmux source-file ~/.config/tmux/dark.conf + ;; + *) + # Change back to the default window style. + tmux source-file ~/.config/tmux/light.conf + ;; +esac From 87f05c5d832c8dfba4c881949e319f8ea5f72c17 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 1 Apr 2025 22:15:23 +0200 Subject: [PATCH 04/29] Split diagnostic configuration to separate file --- tasks/neovim.yml | 3 +++ templates/nvim/init.lua.j2 | 1 + templates/nvim/lua/diagnostic.lua.j2 | 11 +++++++++++ templates/nvim/lua/lsp.lua.j2 | 8 -------- 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 templates/nvim/lua/diagnostic.lua.j2 diff --git a/tasks/neovim.yml b/tasks/neovim.yml index f6e0696..ef4b2e3 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -123,3 +123,6 @@ - src: 'templates/nvim/lua/formatting.lua.j2' dest: '{{ xdg_config_dir }}/nvim/lua/formatting.lua' + + - src: 'templates/nvim/lua/diagnostic.lua.j2' + dest: '{{ xdg_config_dir }}/nvim/lua/diagnostic.lua' diff --git a/templates/nvim/init.lua.j2 b/templates/nvim/init.lua.j2 index 309c912..d017527 100644 --- a/templates/nvim/init.lua.j2 +++ b/templates/nvim/init.lua.j2 @@ -12,3 +12,4 @@ require('_nvim-tree') require('lua-line') require('_source-link') require('formatting') +require('diagnostic') diff --git a/templates/nvim/lua/diagnostic.lua.j2 b/templates/nvim/lua/diagnostic.lua.j2 new file mode 100644 index 0000000..97baa9e --- /dev/null +++ b/templates/nvim/lua/diagnostic.lua.j2 @@ -0,0 +1,11 @@ +-- {{ ansible_managed }} + +vim.diagnostic.config { + float = { + suffix = function(diagnostic) + return (' %s | [%s]'):format(diagnostic.code, diagnostic.source) + end + }, + + virtual_text = { current_line = true } +} diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index b324de2..55da53c 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -186,11 +186,3 @@ cmp.setup { end, }, } - -vim.diagnostic.config { - float = { - suffix = function(diagnostic) - return (' %s | [%s]'):format(diagnostic.code, diagnostic.source) - end - }, -} From f21944eb52b862bdc982588aa41b196f68b50a03 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 2 Apr 2025 09:10:04 +0200 Subject: [PATCH 05/29] Remove global formatting configuration Will be replaced with project specific configurations --- templates/nvim/init.lua.j2 | 1 - templates/nvim/lua/formatting.lua.j2 | 24 ------------------------ templates/nvim/lua/lsp.lua.j2 | 2 -- 3 files changed, 27 deletions(-) delete mode 100644 templates/nvim/lua/formatting.lua.j2 diff --git a/templates/nvim/init.lua.j2 b/templates/nvim/init.lua.j2 index d017527..a18b81c 100644 --- a/templates/nvim/init.lua.j2 +++ b/templates/nvim/init.lua.j2 @@ -11,5 +11,4 @@ require('indent-blankline') require('_nvim-tree') require('lua-line') require('_source-link') -require('formatting') require('diagnostic') diff --git a/templates/nvim/lua/formatting.lua.j2 b/templates/nvim/lua/formatting.lua.j2 deleted file mode 100644 index 10c6332..0000000 --- a/templates/nvim/lua/formatting.lua.j2 +++ /dev/null @@ -1,24 +0,0 @@ --- {{ ansible_managed }} - -local enable_formatting = vim.env.enable_formatting == 'true'; - -if (enable_formatting) then - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('lsp', { clear = true }), - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - - if client.server_capabilities.documentFormattingProvider then - vim.api.nvim_create_autocmd('BufWritePre', { - buffer = args.buf, - callback = function() - vim.lsp.buf.format { - async = false, - id = args.data.client_id - } - end, - }) - end - end - }) -end diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index 55da53c..c3a4234 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -23,10 +23,8 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) vim.keymap.set('n', 'la', vim.lsp.buf.code_action, opts) - end - --enable some language servers with the additional completion capabilities --offered by nvim-cmp local servers = { From 0caa8c07fc86e7a9177bb911ac064318c776b1f6 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 2 Apr 2025 09:57:05 +0200 Subject: [PATCH 06/29] Remove leftover file after f21944eb52b862bdc982588aa41b196f68b50a03 --- tasks/neovim.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tasks/neovim.yml b/tasks/neovim.yml index ef4b2e3..e7de9d5 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -121,8 +121,5 @@ - src: 'templates/nvim/lua/filetype.lua.j2' dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua' - - src: 'templates/nvim/lua/formatting.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/formatting.lua' - - src: 'templates/nvim/lua/diagnostic.lua.j2' dest: '{{ xdg_config_dir }}/nvim/lua/diagnostic.lua' From 1b881c1559cfc27377967ece343e29196a3313f3 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 3 Apr 2025 21:27:18 +0200 Subject: [PATCH 07/29] Enable project specific configuration --- group_vars/all/neovim.yml | 3 +++ templates/nvim/lua/options.lua.j2 | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/group_vars/all/neovim.yml b/group_vars/all/neovim.yml index 2e1e9ab..ae2f5d9 100644 --- a/group_vars/all/neovim.yml +++ b/group_vars/all/neovim.yml @@ -42,5 +42,8 @@ neovim_plugins: - url: 'https://github.com/projekt0n/github-nvim-theme.git' name: 'github-colors' version: 'v1.1.2' + - url: 'https://github.com/stevearc/conform.nvim.git' + name: 'conform.nvim' + version: 'v9.0.0' language_servers: [] diff --git a/templates/nvim/lua/options.lua.j2 b/templates/nvim/lua/options.lua.j2 index 36bbe52..656910c 100644 --- a/templates/nvim/lua/options.lua.j2 +++ b/templates/nvim/lua/options.lua.j2 @@ -55,5 +55,9 @@ vim.o.termguicolors = true vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 +-- load project specific configuration files +vim.o.exrc = true +vim.o.secure = true + -- python interpreter vim.g.python3_host_prog = '/usr/bin/python3' From bdc337b3cb1d1b9719307340cf91d9c49f00e4f6 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 3 Apr 2025 21:36:45 +0200 Subject: [PATCH 08/29] Remove deprecated env variable --- files/tmux.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/tmux.sh b/files/tmux.sh index 01e0223..d98c41b 100755 --- a/files/tmux.sh +++ b/files/tmux.sh @@ -2,7 +2,6 @@ session_name=${PWD##*/} project_directory="$HOME/development/$session_name" -enable_formatting="false" tmux has-session -t $session_name @@ -11,8 +10,7 @@ then tmux new-session \ -c $project_directory \ -ds $session_name \ - -e "project_dir=$project_directory" \ - -e "enable_formatting=$enable_formatting" + -e "project_dir=$project_directory" # FIRST WINDOW tmux send-keys -t $session_name:0 'source ./env/bin/activate' C-m From 5e0ff0dbc5e6ebd137551be4735763fe6e386261 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 3 Apr 2025 21:37:12 +0200 Subject: [PATCH 09/29] Add project specific nvim configuration file example --- files/nvim.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 files/nvim.lua diff --git a/files/nvim.lua b/files/nvim.lua new file mode 100644 index 0000000..46ee351 --- /dev/null +++ b/files/nvim.lua @@ -0,0 +1,14 @@ +-- example of a project specific nvim configuration file using :exrc + +local conform = require 'conform'; + +conform.setup { + formatters_by_ft = { + python = { 'isort', 'black' }, + javascript = { 'prettier', }, + }, + + format_on_save = { + lsp_format = 'never', + } +} From ca9edc9d38cd1e57f44d2f16e7aa34e91727630d Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 3 Apr 2025 22:22:09 +0200 Subject: [PATCH 10/29] Add nvim lsp formatting configuration example --- files/{nvim.lua => nvim.conform.lua} | 2 +- files/nvim.lsp.lua | 33 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) rename files/{nvim.lua => nvim.conform.lua} (94%) create mode 100644 files/nvim.lsp.lua diff --git a/files/nvim.lua b/files/nvim.conform.lua similarity index 94% rename from files/nvim.lua rename to files/nvim.conform.lua index 46ee351..801df29 100644 --- a/files/nvim.lua +++ b/files/nvim.conform.lua @@ -1,4 +1,4 @@ --- example of a project specific nvim configuration file using :exrc +-- example of a project specific nvim configuration file using :exrc and conform local conform = require 'conform'; diff --git a/files/nvim.lsp.lua b/files/nvim.lsp.lua new file mode 100644 index 0000000..ff06a44 --- /dev/null +++ b/files/nvim.lsp.lua @@ -0,0 +1,33 @@ +-- example of a project specific nvim configuration file using :exrc and lsp formatting + +local format_clients = { + 'ruff', + 'lua_ls', + 'bashls', + 'jsonls', + 'ts_ls', + 'ansiblels', + 'yamlls', + 'cssls', + 'html', +} + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('lsp', { clear = true }), + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + + if client:supports_method('textDocument/formatting') + and vim.tbl_contains(format_clients, client.name) then + vim.api.nvim_create_autocmd('BufWritePre', { + buffer = args.buf, + callback = function() + vim.lsp.buf.format { + async = false, + id = args.data.client_id + } + end, + }) + end + end +}) From c8ee2a0623cfedbf8c0e9ca63202e2d3546f65f9 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 5 Apr 2025 14:06:33 +0200 Subject: [PATCH 11/29] Update neovim for debian hosts --- group_vars/debian/neovim.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/group_vars/debian/neovim.yml b/group_vars/debian/neovim.yml index c5e5319..8a9fe79 100644 --- a/group_vars/debian/neovim.yml +++ b/group_vars/debian/neovim.yml @@ -13,6 +13,6 @@ language_servers: auto_setup: true neovim: - version: 'v0.10.4' + version: 'v0.11.0' install_path: '/opt/nvim' - download_checksum: sha256:95aaa8e89473f5421114f2787c13ae0ec6e11ebbd1a13a1bd6fcf63420f8073f + download_checksum: sha256:fe0a5bc79e64c5e4d9f844cd96157ebd3919ef1343b329e9ebc3f455924cc7d6 From 3820b79fafc0f34eccb596e498a8c517b3082755 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Mon, 7 Apr 2025 20:45:29 +0200 Subject: [PATCH 12/29] Disable mouse options for neovim --- templates/nvim/lua/options.lua.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/nvim/lua/options.lua.j2 b/templates/nvim/lua/options.lua.j2 index 656910c..fe35a80 100644 --- a/templates/nvim/lua/options.lua.j2 +++ b/templates/nvim/lua/options.lua.j2 @@ -59,5 +59,8 @@ vim.g.loaded_netrwPlugin = 1 vim.o.exrc = true vim.o.secure = true +-- disable mouse options +vim.opt.mouse = '' + -- python interpreter vim.g.python3_host_prog = '/usr/bin/python3' From 5edc5bd7e1bed423b0f7fa88e166361020e0eee7 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 29 Apr 2025 08:57:26 +0200 Subject: [PATCH 13/29] Use groups in playbook hosts --- playbook.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbook.yml b/playbook.yml index 2c644c2..8ab70f7 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,8 +1,8 @@ - name: Development provisioning hosts: - - xps - - desktop - - fudiggity + - personal + - arch + - debian pre_tasks: - name: Verifying that a limit is set ansible.builtin.fail: From 8ad75b702916695163a82bc22613515d229a7db1 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 29 Apr 2025 08:58:04 +0200 Subject: [PATCH 14/29] Group keybinds by function --- templates/nvim/lua/lsp.lua.j2 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index c3a4234..12e6684 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -7,22 +7,24 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'la', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) - vim.keymap.set('n', 'la', vim.lsp.buf.code_action, opts) end --enable some language servers with the additional completion capabilities From 8864a5d37e51f46838ead91f86dc635caac066a8 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 29 Apr 2025 09:05:41 +0200 Subject: [PATCH 15/29] Increase telescope size & position --- templates/nvim/lua/telescope.lua.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/nvim/lua/telescope.lua.j2 b/templates/nvim/lua/telescope.lua.j2 index b74a42f..18c509e 100644 --- a/templates/nvim/lua/telescope.lua.j2 +++ b/templates/nvim/lua/telescope.lua.j2 @@ -18,7 +18,8 @@ telescope.setup({ defaults = { layout_strategy = 'vertical', layout_config = { - vertical = { width = 0.5, height = 0.7 } + prompt_position = 'top', + vertical = { width = 0.8, height = 0.9 } }, }, }) From d65dc0ef3b88e8aa9e2895094962ae5ccab02cf1 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 29 Apr 2025 09:14:09 +0200 Subject: [PATCH 16/29] Allow searching hidden/ignored files --- templates/nvim/lua/telescope.lua.j2 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/nvim/lua/telescope.lua.j2 b/templates/nvim/lua/telescope.lua.j2 index 18c509e..d568703 100644 --- a/templates/nvim/lua/telescope.lua.j2 +++ b/templates/nvim/lua/telescope.lua.j2 @@ -5,8 +5,18 @@ local builtin = require('telescope.builtin') local opts = { noremap = true, silent = true } +local find_files_unignored = function() + builtin.find_files { hidden = true, no_ignore = true } +end + +local live_grep_unignored = function() + builtin.live_grep { additional_args = { '--unrestricted', '--unrestricted' } } +end + vim.keymap.set('n', 'ff', builtin.find_files, opts) +vim.keymap.set('n', 'fF', find_files_unignored, opts) vim.keymap.set('n', 'fg', builtin.live_grep, opts) +vim.keymap.set('n', 'fG', live_grep_unignored, opts) vim.keymap.set('n', 'fb', builtin.buffers, opts) vim.keymap.set('n', 'fh', builtin.help_tags, opts) vim.keymap.set('n', 'fj', builtin.jumplist, opts) From 224b9d08f0ef3da5f56e75114b30cc436df7be32 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sun, 11 May 2025 08:19:08 +0200 Subject: [PATCH 17/29] Add fd to packages --- group_vars/arch/system.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/group_vars/arch/system.yml b/group_vars/arch/system.yml index ae21d6d..2b262ba 100644 --- a/group_vars/arch/system.yml +++ b/group_vars/arch/system.yml @@ -14,4 +14,5 @@ packages: - slirp4netns - tree-sitter - ripgrep + - fd - uv From 95c5cddab20ea54cbf7ed4bdfa84205ca14cc2c0 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 8 Oct 2025 20:54:10 +0200 Subject: [PATCH 18/29] 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 19/29] 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 20/29] 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 21/29] 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 22/29] 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' From 5e1ddd690d6cfc497489ae5433eac4bdedc43f0b Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 11 Oct 2025 09:11:51 +0200 Subject: [PATCH 23/29] Add keybinding for searching through current buffer --- templates/nvim/lua/telescope.lua.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/nvim/lua/telescope.lua.j2 b/templates/nvim/lua/telescope.lua.j2 index 38a5adc..4de57a6 100644 --- a/templates/nvim/lua/telescope.lua.j2 +++ b/templates/nvim/lua/telescope.lua.j2 @@ -17,7 +17,8 @@ vim.keymap.set('n', 'ff', builtin.find_files, opts) vim.keymap.set('n', 'fF', find_files_unignored, opts) vim.keymap.set('n', 'fg', builtin.live_grep, opts) vim.keymap.set('n', 'fG', live_grep_unignored, opts) -vim.keymap.set('n', 'fb', builtin.buffers, opts) +vim.keymap.set('n', 'fb', builtin.current_buffer_fuzzy_find, opts) +vim.keymap.set('n', 'fB', builtin.buffers, opts) vim.keymap.set('n', 'fh', builtin.help_tags, opts) vim.keymap.set('n', 'fj', builtin.jumplist, opts) vim.keymap.set('n', 'fl', builtin.loclist, opts) From 7d363a30b24e82ffeaeffa8b18f7a6746aabe617 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 11 Oct 2025 09:18:19 +0200 Subject: [PATCH 24/29] Update debian neovim version --- group_vars/debian/neovim.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/group_vars/debian/neovim.yml b/group_vars/debian/neovim.yml index 8a9fe79..af2c892 100644 --- a/group_vars/debian/neovim.yml +++ b/group_vars/debian/neovim.yml @@ -1,18 +1,18 @@ # TODO: add lua language server, see https://github.com/LuaLS/lua-language-server? language_servers: - - package: '@ansible/ansible-language-server' - server_name: 'ansiblels' + - package: "@ansible/ansible-language-server" + server_name: "ansiblels" auto_setup: true - package: yaml-language-server - server_name: 'yamlls' + server_name: "yamlls" auto_setup: false - package: bash-language-server - server_name: 'bashls' + server_name: "bashls" auto_setup: true neovim: - version: 'v0.11.0' - install_path: '/opt/nvim' - download_checksum: sha256:fe0a5bc79e64c5e4d9f844cd96157ebd3919ef1343b329e9ebc3f455924cc7d6 + version: "v0.11.4" + install_path: "/opt/nvim" + download_checksum: sha256:a74740047e73b2b380d63a474282814063d10650cd6cc95efa16d1713c7e616c From 2fbfbb273fe7476fa3474f61eef6436057be5612 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 11 Oct 2025 20:19:20 +0200 Subject: [PATCH 25/29] Add htpc to inventory --- inventory.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inventory.yml b/inventory.yml index 438697a..7ebdbcf 100644 --- a/inventory.yml +++ b/inventory.yml @@ -6,6 +6,9 @@ personal: desktop: &desktop ansible_connection: local ansible_become_method: community.general.run0 + htpc: &htpc + ansible_connection: local + ansible_become_method: community.general.run0 fudiggity: &fudiggity ansible_connection: local @@ -20,3 +23,5 @@ arch: <<: *xps desktop: <<: *desktop + htpc: + <<: *htpc From 88898151e60c540b9a56b1ce3f059b3bf524500e Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 11 Oct 2025 20:47:29 +0200 Subject: [PATCH 26/29] Include missing packages --- group_vars/arch/system.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/group_vars/arch/system.yml b/group_vars/arch/system.yml index 2b262ba..3bab5fb 100644 --- a/group_vars/arch/system.yml +++ b/group_vars/arch/system.yml @@ -16,3 +16,8 @@ packages: - ripgrep - fd - uv + - fakeroot + - debugedit + - which + - gcc + - make From 086c6217a66c5b1ffb2c206dac48aac86483ad89 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 11 Oct 2025 20:47:47 +0200 Subject: [PATCH 27/29] Update role requirement URL --- requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.yml b/requirements.yml index ba54c45..b20eeb6 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,4 +1,4 @@ -- src: git+https://git.fudiggity.nl/ansible/common.git +- src: git+https://forgejo.fudiggity.nl/sonny/common-ansible.git name: common version: master scm: git From 48cf510079e64ea8cdb94ffc9a8f15923effcf53 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 11 Oct 2025 20:47:58 +0200 Subject: [PATCH 28/29] Create missing directory --- tasks/dotfiles.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index 1d097f9..b8c40e6 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -56,6 +56,12 @@ dest: '{{ xdg_config_dir }}/git/config' mode: '0755' +- name: Create script directory + ansible.builtin.file: + path: '{{ ansible_env.HOME }}/.local/bin' + state: directory + mode: '0755' + - name: Copy tmux toggle script ansible.builtin.template: src: 'templates/tmux-toggle.j2' From 66cde494d827e59e0abc34ab38a79b9dec42fa0c Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 15 Oct 2025 10:02:02 +0200 Subject: [PATCH 29/29] Update used github theme --- 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 067d136..9ae709f 100644 --- a/templates/nvim/lua/colorscheme.lua.j2 +++ b/templates/nvim/lua/colorscheme.lua.j2 @@ -4,7 +4,7 @@ local background_callback = function() if vim.o.background == 'dark' then vim.cmd('colorscheme github_dark_dimmed') else - vim.cmd('colorscheme github_light') + vim.cmd('colorscheme github_light_tritanopia') end -- force a full redraw: