From 12297f538e556bb312a270439b1204d65bac156b Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 21 Mar 2025 09:00:22 +0100 Subject: [PATCH 01/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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/36] 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: From 5c07f3686294da435dbd4c738d36bf3a5afc21c2 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 17 Dec 2025 15:50:56 +0100 Subject: [PATCH 30/36] Remove custom ruff configuration --- templates/nvim/lua/lsp.lua.j2 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index 1da3fdc..f9d4202 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -53,19 +53,10 @@ end local util = require('lspconfig/util') {% if ansible_facts.os_family == 'Archlinux' %} -local python_root_dir = function(fname) - return util.root_pattern('.git', 'setup.cfg', 'requirements')(fname) or - util.path.dirname(fname) -end - -vim.lsp.config['ruff'] = { - on_attach = on_attach, - capabilities = capabilities, - root_dir = python_root_dir -} - vim.lsp.config['pyright'] = { + on_attach = on_attach, + capabilities = capabilities, settings = { pyright = { -- Using Ruff's import organizer From 40247b28c72455989e722058e17f82f383fbd63f Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 17 Dec 2025 15:51:35 +0100 Subject: [PATCH 31/36] Install maintained version of ruff lsp server --- group_vars/arch/neovim.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/group_vars/arch/neovim.yml b/group_vars/arch/neovim.yml index de53353..16b1284 100644 --- a/group_vars/arch/neovim.yml +++ b/group_vars/arch/neovim.yml @@ -1,48 +1,48 @@ language_servers: - package: ansible-language-server - server_name: 'ansiblels' + server_name: "ansiblels" auto_setup: true - package: typescript-language-server - server_name: 'ts_ls' + server_name: "ts_ls" auto_setup: true - package: vscode-json-languageserver - server_name: 'jsonls' + server_name: "jsonls" auto_setup: true - package: vscode-css-languageserver - server_name: 'cssls' + server_name: "cssls" auto_setup: true - package: bash-language-server - server_name: 'bashls' + server_name: "bashls" auto_setup: true - package: marksman - server_name: 'marksman' + server_name: "marksman" auto_setup: true - package: esbonio - server_name: 'esbonio' + server_name: "esbonio" auto_setup: true - package: lua-language-server - server_name: 'lua_ls' + server_name: "lua_ls" auto_setup: false - package: yaml-language-server - server_name: 'yamlls' + server_name: "yamlls" auto_setup: false - package: vscode-html-languageserver - server_name: 'html' + server_name: "html" auto_setup: false - - package: ruff-lsp - server_name: 'ruff' - auto_setup: false + - package: ruff + server_name: "ruff" + auto_setup: true - package: pyright - server_name: 'pyright' + server_name: "pyright" auto_setup: false From 981080c925fd5ec83788fa4da084edf5c2572091 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 17 Dec 2025 15:51:51 +0100 Subject: [PATCH 32/36] Use ssh key to sign commits --- templates/gitconfig.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/gitconfig.j2 b/templates/gitconfig.j2 index 84f97da..3054313 100644 --- a/templates/gitconfig.j2 +++ b/templates/gitconfig.j2 @@ -4,6 +4,9 @@ email = {{ git_email }} name = {{ git_name }} +[gpg] +format = ssh + [core] editor = nvim {% if ansible_facts['os_family'] == 'Archlinux' %} From 50a99389c2ccf06ec747a70b3066a58b4b03d283 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 17 Dec 2025 16:53:44 +0100 Subject: [PATCH 33/36] Add defaults for markdown & rst files --- tasks/neovim.yml | 144 ++++++++++++------------ templates/nvim/ftplugin/markdown.lua.j2 | 7 ++ templates/nvim/ftplugin/rst.lua.j2 | 7 ++ 3 files changed, 89 insertions(+), 69 deletions(-) create mode 100644 templates/nvim/ftplugin/markdown.lua.j2 create mode 100644 templates/nvim/ftplugin/rst.lua.j2 diff --git a/tasks/neovim.yml b/tasks/neovim.yml index e7de9d5..6bdbe68 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -1,35 +1,35 @@ - name: Ensure neovim configuration directories exist ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: directory - mode: '0755' + mode: "0755" loop: - - '{{ xdg_config_dir }}/nvim/' - - '{{ xdg_config_dir }}/nvim/lua' - - '{{ xdg_config_dir }}/nvim/after' - - '{{ xdg_config_dir }}/nvim/after/ftplugin' - - '{{ xdg_data_dir }}/nvim/site' - - '{{ xdg_data_dir }}/nvim/site/pack' - - '{{ xdg_data_dir }}/nvim/site/pack/default' - - '{{ xdg_data_dir }}/nvim/site/pack/default/start' + - "{{ xdg_config_dir }}/nvim/" + - "{{ xdg_config_dir }}/nvim/lua" + - "{{ xdg_config_dir }}/nvim/after" + - "{{ xdg_config_dir }}/nvim/after/ftplugin" + - "{{ xdg_data_dir }}/nvim/site" + - "{{ xdg_data_dir }}/nvim/site/pack" + - "{{ xdg_data_dir }}/nvim/site/pack/default" + - "{{ xdg_data_dir }}/nvim/site/pack/default/start" - name: Remove old neovim packages ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: absent loop: - - '{{ xdg_data_dir }}/nvim/site/pack/default/start/catpuccin' - - '{{ xdg_data_dir }}/nvim/site/pack/default/start/vim-colors-xcode' + - "{{ xdg_data_dir }}/nvim/site/pack/default/start/catpuccin" + - "{{ xdg_data_dir }}/nvim/site/pack/default/start/vim-colors-xcode" # Note that helptags may need to be regenerated (see `:h helptags`) - name: Clone neovim packages ansible.builtin.git: - repo: '{{ item.url }}' - dest: '{{ xdg_data_dir }}/nvim/site/pack/default/start/{{ item.name }}' + repo: "{{ item.url }}" + dest: "{{ xdg_data_dir }}/nvim/site/pack/default/start/{{ item.name }}" update: true version: '{{ item.version | default("HEAD") }}' force: true # some maintainers overwrite existing tags :/ - loop: '{{ neovim_plugins }}' + loop: "{{ neovim_plugins }}" - name: Install neovim node package become: true @@ -39,87 +39,93 @@ - name: Remove old neovim configuration file ansible.builtin.file: - path: '{{ xdg_config_dir }}/nvim/init.vim' + path: "{{ xdg_config_dir }}/nvim/init.vim" state: absent - name: Remove coc.nvim extension ansible.builtin.file: - path: '{{ xdg_data_dir }}/nvim/site/pack/default/start/coc.nvim' + path: "{{ xdg_data_dir }}/nvim/site/pack/default/start/coc.nvim" state: absent - name: Setup neovim configuration files ansible.builtin.template: - dest: '{{ item.dest }}' - src: '{{ item.src }}' - mode: '0755' + dest: "{{ item.dest }}" + src: "{{ item.src }}" + mode: "0755" loop: - - src: 'templates/nvim/ftplugin/bash.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/bash.lua' + - src: "templates/nvim/ftplugin/bash.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/bash.lua" - - src: 'templates/nvim/ftplugin/css.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/css.lua' + - src: "templates/nvim/ftplugin/css.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/css.lua" - - src: 'templates/nvim/ftplugin/html.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/html.lua' - - src: 'templates/nvim/ftplugin/htmldjango.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/htmldjango.lua' + - src: "templates/nvim/ftplugin/html.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/html.lua" + - src: "templates/nvim/ftplugin/htmldjango.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/htmldjango.lua" - - src: 'templates/nvim/ftplugin/javascript.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/javascript.lua' + - src: "templates/nvim/ftplugin/javascript.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/javascript.lua" - - src: 'templates/nvim/ftplugin/json.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/json.lua' + - src: "templates/nvim/ftplugin/json.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/json.lua" - - src: 'templates/nvim/ftplugin/lua.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/lua.lua' + - src: "templates/nvim/ftplugin/lua.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/lua.lua" - - src: 'templates/nvim/ftplugin/python.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/python.lua' + - src: "templates/nvim/ftplugin/markdown.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/markdown.lua" - - src: 'templates/nvim/ftplugin/scss.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/scss.lua' + - src: "templates/nvim/ftplugin/python.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/python.lua" - - src: 'templates/nvim/ftplugin/sh.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/sh.lua' + - src: "templates/nvim/ftplugin/rst.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/rst.lua" - - src: 'templates/nvim/ftplugin/yaml.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/yaml.lua' + - src: "templates/nvim/ftplugin/scss.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/scss.lua" - - src: 'templates/nvim/init.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/init.lua' + - src: "templates/nvim/ftplugin/sh.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/sh.lua" - - src: 'templates/nvim/lua/lsp.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/lsp.lua' + - src: "templates/nvim/ftplugin/yaml.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/after/ftplugin/yaml.lua" - - src: 'templates/nvim/lua/options.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/options.lua' + - src: "templates/nvim/init.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/init.lua" - - src: 'templates/nvim/lua/tree-sitter.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/tree-sitter.lua' + - src: "templates/nvim/lua/lsp.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/lsp.lua" - - src: 'templates/nvim/lua/git-signs.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/git-signs.lua' + - src: "templates/nvim/lua/options.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/options.lua" - - src: 'templates/nvim/lua/lua-line.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/lua-line.lua' + - src: "templates/nvim/lua/tree-sitter.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/tree-sitter.lua" - - src: 'templates/nvim/lua/telescope.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/_telescope.lua' + - src: "templates/nvim/lua/git-signs.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/git-signs.lua" - - src: 'templates/nvim/lua/indent-blankline.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/indent-blankline.lua' + - src: "templates/nvim/lua/lua-line.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/lua-line.lua" - - src: 'templates/nvim/lua/nvim-tree.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/_nvim-tree.lua' + - src: "templates/nvim/lua/telescope.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/_telescope.lua" - - src: 'templates/nvim/lua/colorscheme.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/colorscheme.lua' + - src: "templates/nvim/lua/indent-blankline.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/indent-blankline.lua" - - src: 'templates/nvim/lua/source-link.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/_source-link.lua' + - src: "templates/nvim/lua/nvim-tree.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/_nvim-tree.lua" - - src: 'templates/nvim/lua/filetype.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua' + - src: "templates/nvim/lua/colorscheme.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/colorscheme.lua" - - src: 'templates/nvim/lua/diagnostic.lua.j2' - dest: '{{ xdg_config_dir }}/nvim/lua/diagnostic.lua' + - src: "templates/nvim/lua/source-link.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/_source-link.lua" + + - src: "templates/nvim/lua/filetype.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/_filetype.lua" + + - src: "templates/nvim/lua/diagnostic.lua.j2" + dest: "{{ xdg_config_dir }}/nvim/lua/diagnostic.lua" diff --git a/templates/nvim/ftplugin/markdown.lua.j2 b/templates/nvim/ftplugin/markdown.lua.j2 new file mode 100644 index 0000000..058970f --- /dev/null +++ b/templates/nvim/ftplugin/markdown.lua.j2 @@ -0,0 +1,7 @@ +-- {{ ansible_managed }} + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.autoindent = true diff --git a/templates/nvim/ftplugin/rst.lua.j2 b/templates/nvim/ftplugin/rst.lua.j2 new file mode 100644 index 0000000..058970f --- /dev/null +++ b/templates/nvim/ftplugin/rst.lua.j2 @@ -0,0 +1,7 @@ +-- {{ ansible_managed }} + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.autoindent = true From 24b567fc5715d65e22f7074a7befc7a307d082b2 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 7 Jan 2026 14:25:13 +0100 Subject: [PATCH 34/36] Allow searching through diagnostics --- 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 4de57a6..95c3bc0 100644 --- a/templates/nvim/lua/telescope.lua.j2 +++ b/templates/nvim/lua/telescope.lua.j2 @@ -20,6 +20,7 @@ vim.keymap.set('n', 'fG', live_grep_unignored, 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', 'fd', builtin.diagnostics, opts) vim.keymap.set('n', 'fj', builtin.jumplist, opts) vim.keymap.set('n', 'fl', builtin.loclist, opts) vim.keymap.set('n', 'fq', builtin.quickfix, opts) From 347104529fa456c4c49a8b01cc697266e59d9e3d Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 16 Jan 2026 10:20:25 +0100 Subject: [PATCH 35/36] Applied ansible-lint fixes --- group_vars/all/git.yml | 7 +-- group_vars/all/neovim.yml | 93 ++++++++++++++++++------------------ group_vars/all/system.yml | 5 +- group_vars/arch/aur.yml | 47 +++++++++--------- group_vars/arch/neovim.yml | 1 + group_vars/arch/system.yml | 1 + group_vars/debian/neovim.yml | 1 + group_vars/debian/system.yml | 1 + inventory.yml | 2 +- playbook.yml | 33 ++++++------- requirements.yml | 1 + tasks/arch/aur-package.yml | 29 +++++------ tasks/arch/aur.yml | 23 ++++----- tasks/arch/docker.yml | 25 +++++----- tasks/arch/neovim.yml | 3 +- tasks/arch/nvm.yml | 7 +-- tasks/arch/python.yml | 77 ++++++++++++++--------------- tasks/debian/neovim.yml | 35 +++++++------- tasks/dotfiles.yml | 67 +++++++++++++------------- tasks/neovim.yml | 1 + 20 files changed, 239 insertions(+), 220 deletions(-) diff --git a/group_vars/all/git.yml b/group_vars/all/git.yml index 4715cd3..b44e7e1 100644 --- a/group_vars/all/git.yml +++ b/group_vars/all/git.yml @@ -1,7 +1,8 @@ -dotfiles_repo: 'git@forgejo.fudiggity.nl:sonny/dotfiles.git' +--- +dotfiles_repo: "git@forgejo.fudiggity.nl:sonny/dotfiles.git" -git_domain: 'forgejo.fudiggity.nl' -git_host_key: 'forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+' +git_domain: "forgejo.fudiggity.nl" +git_host_key: "forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+" git_name: Sonny Bakker git_email: sonny871@hotmail.com diff --git a/group_vars/all/neovim.yml b/group_vars/all/neovim.yml index e67edd3..767a4b7 100644 --- a/group_vars/all/neovim.yml +++ b/group_vars/all/neovim.yml @@ -1,50 +1,51 @@ +--- neovim_plugins: - - url: 'https://forgejo.fudiggity.nl/sonny/source-link.lua' - name: 'source-link' - - url: 'https://github.com/nvim-tree/nvim-tree.lua' - name: 'nvim-tree' - - url: 'https://github.com/nvim-tree/nvim-web-devicons' - name: 'nvim-tree-icons' - - url: 'https://github.com/neovim/nvim-lspconfig' - name: 'nvim-lspconfig' - - url: 'https://github.com/hrsh7th/nvim-cmp' - name: 'nvim-cmp' - - url: 'https://github.com/hrsh7th/cmp-buffer' - name: 'cmp-buffer' - - url: 'https://github.com/hrsh7th/cmp-path' - name: 'cmp-path' - - url: 'https://github.com/hrsh7th/cmp-omni' - name: 'cmp-omni' - - url: 'https://github.com/hrsh7th/cmp-nvim-lsp' - name: 'cmp-nvim-lsp' - - url: 'https://github.com/hrsh7th/cmp-nvim-lua' - name: 'cmp-nvim-lua' - - url: 'https://github.com/nvim-treesitter/nvim-treesitter' - name: 'nvim-treesitter' + - url: "https://forgejo.fudiggity.nl/sonny/source-link.lua" + name: "source-link" + - url: "https://github.com/nvim-tree/nvim-tree.lua" + name: "nvim-tree" + - url: "https://github.com/nvim-tree/nvim-web-devicons" + name: "nvim-tree-icons" + - url: "https://github.com/neovim/nvim-lspconfig" + name: "nvim-lspconfig" + - url: "https://github.com/hrsh7th/nvim-cmp" + name: "nvim-cmp" + - url: "https://github.com/hrsh7th/cmp-buffer" + name: "cmp-buffer" + - url: "https://github.com/hrsh7th/cmp-path" + name: "cmp-path" + - url: "https://github.com/hrsh7th/cmp-omni" + name: "cmp-omni" + - url: "https://github.com/hrsh7th/cmp-nvim-lsp" + name: "cmp-nvim-lsp" + - url: "https://github.com/hrsh7th/cmp-nvim-lua" + 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' - name: 'telescope-fzf-native.nvim' - - url: 'https://github.com/nvim-telescope/telescope.nvim' - name: 'telescope.nvim' - version: '0.1.x' - - url: 'https://github.com/L3MON4D3/LuaSnip' - name: 'luasnip' - version: 'v1.0.0' - - url: 'https://github.com/lewis6991/gitsigns.nvim' - name: 'gitsigns.nvim' - version: 'v0.9.0' - - url: 'https://github.com/nvim-lualine/lualine.nvim' - name: 'lualine' - - url: 'https://github.com/lukas-reineke/indent-blankline.nvim' - name: 'indent-blankline.nvim' - version: 'v3.7.2' - - 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' + - url: "https://github.com/nvim-lua/plenary.nvim" + name: "plenary.nvim" + - url: "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + name: "telescope-fzf-native.nvim" + - url: "https://github.com/nvim-telescope/telescope.nvim" + name: "telescope.nvim" + version: "0.1.x" + - url: "https://github.com/L3MON4D3/LuaSnip" + name: "luasnip" + version: "v1.0.0" + - url: "https://github.com/lewis6991/gitsigns.nvim" + name: "gitsigns.nvim" + version: "v0.9.0" + - url: "https://github.com/nvim-lualine/lualine.nvim" + name: "lualine" + - url: "https://github.com/lukas-reineke/indent-blankline.nvim" + name: "indent-blankline.nvim" + version: "v3.7.2" + - 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/group_vars/all/system.yml b/group_vars/all/system.yml index f57d500..d056de1 100644 --- a/group_vars/all/system.yml +++ b/group_vars/all/system.yml @@ -1,4 +1,5 @@ -xdg_config_dir: '{{ ansible_env.HOME }}/.config' -xdg_data_dir: '{{ ansible_env.HOME }}/.local/share' +--- +xdg_config_dir: "{{ ansible_env.HOME }}/.config" +xdg_data_dir: "{{ ansible_env.HOME }}/.local/share" packages: [] diff --git a/group_vars/arch/aur.yml b/group_vars/arch/aur.yml index 6f1c646..a14af3d 100644 --- a/group_vars/arch/aur.yml +++ b/group_vars/arch/aur.yml @@ -1,40 +1,41 @@ +--- aur_packages: - - url: 'https://aur.archlinux.org/nvm.git' - name: 'nvm' - package_name: 'nvm' - version: '0.40.0-1' - arch: 'any' + - url: "https://aur.archlinux.org/nvm.git" + name: "nvm" + package_name: "nvm" + version: "0.40.0-1" + arch: "any" -aur_build_dir: '/usr/local/src' -python_build_dir: '/usr/local/src' -python_install_dir: '/opt' +aur_build_dir: "/usr/local/src" +python_build_dir: "/usr/local/src" +python_install_dir: "/opt" -python_download_url: 'https://www.python.org/ftp/python' +python_download_url: "https://www.python.org/ftp/python" python_versions: - version: 3.12.9 - path: 'python3.12' - binary: 'python3.12' + path: "python3.12" + binary: "python3.12" - version: 3.11.9 - path: 'python3.11' - binary: 'python3.11' + path: "python3.11" + binary: "python3.11" - version: 3.10.0 - path: 'python3.10' - binary: 'python3.10' + path: "python3.10" + binary: "python3.10" - version: 3.9.14 - path: 'python3.9' - binary: 'python3.9' + path: "python3.9" + binary: "python3.9" - version: 3.8.14 - path: 'python3.8' - binary: 'python3.8' + path: "python3.8" + binary: "python3.8" - version: 3.7.14 - path: 'python3.7' - binary: 'python3.7' + path: "python3.7" + binary: "python3.7" - version: 3.6.15 - path: 'python3.6' - binary: 'python3.6' + path: "python3.6" + binary: "python3.6" diff --git a/group_vars/arch/neovim.yml b/group_vars/arch/neovim.yml index 16b1284..debc75b 100644 --- a/group_vars/arch/neovim.yml +++ b/group_vars/arch/neovim.yml @@ -1,3 +1,4 @@ +--- language_servers: - package: ansible-language-server server_name: "ansiblels" diff --git a/group_vars/arch/system.yml b/group_vars/arch/system.yml index 3bab5fb..0d2feef 100644 --- a/group_vars/arch/system.yml +++ b/group_vars/arch/system.yml @@ -1,3 +1,4 @@ +--- packages: - python - git diff --git a/group_vars/debian/neovim.yml b/group_vars/debian/neovim.yml index af2c892..cb53eb6 100644 --- a/group_vars/debian/neovim.yml +++ b/group_vars/debian/neovim.yml @@ -1,3 +1,4 @@ +--- # TODO: add lua language server, see https://github.com/LuaLS/lua-language-server? language_servers: - package: "@ansible/ansible-language-server" diff --git a/group_vars/debian/system.yml b/group_vars/debian/system.yml index 56be4aa..2660131 100644 --- a/group_vars/debian/system.yml +++ b/group_vars/debian/system.yml @@ -1,3 +1,4 @@ +--- packages: - python3 - git diff --git a/inventory.yml b/inventory.yml index 7ebdbcf..5f1897f 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,3 +1,4 @@ +--- personal: hosts: xps: &xps @@ -16,7 +17,6 @@ debian: hosts: fudiggity: <<: *fudiggity - arch: hosts: xps: diff --git a/playbook.yml b/playbook.yml index 8ab70f7..3a63d77 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,3 +1,4 @@ +--- - name: Development provisioning hosts: - personal @@ -6,38 +7,38 @@ pre_tasks: - name: Verifying that a limit is set ansible.builtin.fail: - msg: 'This playbook cannot be run with no limit' + msg: "This playbook cannot be run with no limit" run_once: true when: ansible_limit is not defined - name: Install packages become: true ansible.builtin.package: - name: '{{ item }}' + name: "{{ item }}" state: present - loop: '{{ packages }}' + loop: "{{ packages }}" - name: Add git forge to known hosts ansible.builtin.include_role: name: common - tasks_from: 'known_hosts.yml' + tasks_from: "known_hosts.yml" vars: - user: '{{ ansible_user_id }}' + user: "{{ ansible_user_id }}" items: - - domain: '{{ git_domain }}' - key: '{{ git_host_key }}' + - domain: "{{ git_domain }}" + key: "{{ git_host_key }}" when: ansible_hostname != 'fudiggity' tasks: - name: Setup dotfiles - ansible.builtin.import_tasks: 'tasks/dotfiles.yml' + ansible.builtin.import_tasks: "tasks/dotfiles.yml" tags: dotfiles - name: Include generic neovim tasks - ansible.builtin.import_tasks: 'tasks/neovim.yml' + ansible.builtin.import_tasks: "tasks/neovim.yml" tags: neovim - name: Include debian neovim tasks - ansible.builtin.import_tasks: 'tasks/debian/neovim.yml' + ansible.builtin.import_tasks: "tasks/debian/neovim.yml" when: "'debian' in group_names" tags: neovim @@ -49,23 +50,23 @@ manager: pacman - name: Include arch neovim tasks - ansible.builtin.import_tasks: 'tasks/arch/neovim.yml' + ansible.builtin.import_tasks: "tasks/arch/neovim.yml" when: "'arch' in group_names" tags: neovim - name: Install AUR packages - ansible.builtin.import_tasks: 'tasks/arch/aur.yml' + ansible.builtin.import_tasks: "tasks/arch/aur.yml" tags: aur - name: Setup docker - ansible.builtin.import_tasks: 'tasks/arch/docker.yml' + ansible.builtin.import_tasks: "tasks/arch/docker.yml" tags: docker - name: Setup python versions - ansible.builtin.include_tasks: 'tasks/arch/python.yml' - loop: '{{ python_versions }}' + ansible.builtin.include_tasks: "tasks/arch/python.yml" + loop: "{{ python_versions }}" tags: python - name: Setup NVM - ansible.builtin.import_tasks: 'tasks/arch/nvm.yml' + ansible.builtin.import_tasks: "tasks/arch/nvm.yml" tags: nvm diff --git a/requirements.yml b/requirements.yml index b20eeb6..7a0710c 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,3 +1,4 @@ +--- - src: git+https://forgejo.fudiggity.nl/sonny/common-ansible.git name: common version: master diff --git a/tasks/arch/aur-package.yml b/tasks/arch/aur-package.yml index e00f8ab..8955b63 100644 --- a/tasks/arch/aur-package.yml +++ b/tasks/arch/aur-package.yml @@ -1,9 +1,10 @@ +--- - name: Set package directory ansible.builtin.set_fact: - build_dir: '{{ aur_build_dir }}/{{ item.name }}' + build_dir: "{{ aur_build_dir }}/{{ item.name }}" -- name: 'Retrieve package name for {{ item.name }}' - command: +- name: "Retrieve package name for {{ item.name }}" + ansible.builtin.command: argv: - grep - --only-matching @@ -12,8 +13,8 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_name -- name: 'Retrieve package version for {{ item.name }}' - command: +- name: "Retrieve package version for {{ item.name }}" + ansible.builtin.command: argv: - grep - --only-matching @@ -22,8 +23,8 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_version -- name: 'Retrieve package release for {{ item.name }}' - command: +- name: "Retrieve package release for {{ item.name }}" + ansible.builtin.command: argv: - grep - --only-matching @@ -34,20 +35,20 @@ - name: Set package filename & version ansible.builtin.set_fact: - package_filename: '{{ pkg_name.stdout }}-{{ pkg_version.stdout }}-{{ pkg_release.stdout }}-{{ item.arch }}.pkg.tar.zst' + package_filename: "{{ pkg_name.stdout }}-{{ pkg_version.stdout }}-{{ pkg_release.stdout }}-{{ item.arch }}.pkg.tar.zst" installed_version: ansible_facts.packages[item.package_name].version|default('') -- name: 'Build package {{ item.name }}' - ansible.builtin.command: 'makepkg --syncdeps --rmdeps --clean --noconfirm --force' +- name: "Build package {{ item.name }}" + ansible.builtin.command: "makepkg --syncdeps --rmdeps --clean --noconfirm --force" args: - chdir: '{{ build_dir }}' - creates: '{{ build_dir }}/{{ package_filename }}' + chdir: "{{ build_dir }}" + creates: "{{ build_dir }}/{{ package_filename }}" register: package_build when: item.version != installed_version -- name: 'Install {{ item.name }}' +- name: "Install {{ item.name }}" become: true community.general.pacman: - name: '{{ build_dir }}/{{ package_filename }}' + name: "{{ build_dir }}/{{ package_filename }}" state: present when: item.version != installed_version diff --git a/tasks/arch/aur.yml b/tasks/arch/aur.yml index e31aab7..14ce325 100644 --- a/tasks/arch/aur.yml +++ b/tasks/arch/aur.yml @@ -1,26 +1,27 @@ +--- - name: Retrieve directory stats ansible.builtin.stat: - path: '{{ aur_build_dir }}/{{ item.name }}' - loop: '{{ aur_packages }}' + path: "{{ aur_build_dir }}/{{ item.name }}" + loop: "{{ aur_packages }}" - name: Clone aur packages become: true ansible.builtin.git: - repo: '{{ item.url }}' - dest: '{{ aur_build_dir }}/{{ item.name }}' + repo: "{{ item.url }}" + dest: "{{ aur_build_dir }}/{{ item.name }}" update: true - loop: '{{ aur_packages }}' + loop: "{{ aur_packages }}" - name: Change aur package directories owner become: true ansible.builtin.file: - path: '{{ aur_build_dir }}/{{ item.name }}' + path: "{{ aur_build_dir }}/{{ item.name }}" state: directory - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_id }}' + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" recurse: true - loop: '{{ aur_packages }}' + loop: "{{ aur_packages }}" - name: Build & install aur packages - ansible.builtin.include_tasks: 'tasks/arch/aur-package.yml' - loop: '{{ aur_packages }}' + ansible.builtin.include_tasks: "tasks/arch/aur-package.yml" + loop: "{{ aur_packages }}" diff --git a/tasks/arch/docker.yml b/tasks/arch/docker.yml index c68a81f..fa96d20 100644 --- a/tasks/arch/docker.yml +++ b/tasks/arch/docker.yml @@ -1,7 +1,8 @@ +--- - name: Remove docker mapping files become: true ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: absent loop: - /etc/subgid @@ -10,38 +11,38 @@ - name: Setup desktop configuration become: true ansible.builtin.file: - path: 'files/desktop/docker-daemon.json' - dest: '/etc/docker/daemon.json' - mode: '0755' + path: "files/desktop/docker-daemon.json" + dest: "/etc/docker/daemon.json" + mode: "0755" when: ansible_hostname == 'desktop' - name: Remove user setup desktop configuration ansible.builtin.file: - path: '{{ xdg_config_dir }}/docker/daemon.json' + path: "{{ xdg_config_dir }}/docker/daemon.json" state: absent when: ansible_hostname == 'desktop' - name: Check for .bashrc.override ansible.builtin.stat: - path: '{{ ansible_env.HOME }}/.bashrc.override' + path: "{{ ansible_env.HOME }}/.bashrc.override" register: bashrc_override - name: Create .bashrc.override ansible.builtin.file: - path: '{{ ansible_env.HOME }}/.bashrc.override' + path: "{{ ansible_env.HOME }}/.bashrc.override" state: touch - mode: '0755' + mode: "0755" when: not bashrc_override.stat.exists - name: Remove rootless DOCKER_HOST variable assignment ansible.builtin.lineinfile: - path: '{{ ansible_env.HOME }}/.bashrc.override' - regexp: '^export DOCKER_HOST=' - line: '' + path: "{{ ansible_env.HOME }}/.bashrc.override" + regexp: "^export DOCKER_HOST=" + line: "" - name: Disable user docker socket ansible.builtin.systemd: - name: '{{ item }}' + name: "{{ item }}" state: stopped enabled: false scope: user diff --git a/tasks/arch/neovim.yml b/tasks/arch/neovim.yml index 0cccfa1..6851bbb 100644 --- a/tasks/arch/neovim.yml +++ b/tasks/arch/neovim.yml @@ -1,6 +1,7 @@ +--- - name: Install language servers become: true community.general.pacman: - name: '{{ item }}' + name: "{{ item }}" state: present loop: '{{ language_servers | map(attribute="package") | list }}' diff --git a/tasks/arch/nvm.yml b/tasks/arch/nvm.yml index b2f2e36..2a29236 100644 --- a/tasks/arch/nvm.yml +++ b/tasks/arch/nvm.yml @@ -1,15 +1,16 @@ +--- - name: Set NVM install directory ansible.builtin.set_fact: - install_dir: '{{ xdg_config_dir }}/nvm' + install_dir: "{{ xdg_config_dir }}/nvm" - name: Remove manually installed nvm install directory ansible.builtin.file: - path: '{{ install_dir }}' + path: "{{ install_dir }}" state: absent - name: Remove nvm entry from bashrc ansible.builtin.lineinfile: - path: '{{ ansible_env.HOME }}/.bashrc.override' + path: "{{ ansible_env.HOME }}/.bashrc.override" line: > [ -s "{{ install_dir }}/nvm.sh" ] && \. "{{ install_dir }}/nvm.sh" # This loads nvm state: absent diff --git a/tasks/arch/python.yml b/tasks/arch/python.yml index 72bfbff..ddc6fb4 100644 --- a/tasks/arch/python.yml +++ b/tasks/arch/python.yml @@ -1,65 +1,66 @@ -- name: 'check for {{ item.binary }} binary' - command: 'which {{ item.binary }}' +--- +- name: "Check for {{ item.binary }} binary" + ansible.builtin.command: "which {{ item.binary }}" changed_when: false failed_when: python_installed.rc not in [ 0, 1 ] register: python_installed -- name: 'check for {{ item.binary }} download' - stat: - path: '{{ python_build_dir }}/python-{{ item.version }}.tgz' +- name: "Check for {{ item.binary }} download" + ansible.builtin.stat: + path: "{{ python_build_dir }}/python-{{ item.version }}.tgz" register: python_download -- block: +- when: python_installed.rc not in [ 0 ] + block: # TODO: verify for checksum - - name: 'retrieve python {{ item.version }} source' + - name: "Retrieve python {{ item.version }} source" become: true - get_url: - url: '{{ python_download_url }}/{{ item.version }}/Python-{{ item.version }}.tgz' - dest: '{{ python_build_dir }}/python-{{ item.version }}.tgz' - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_id }}' + ansible.builtin.get_url: + url: "{{ python_download_url }}/{{ item.version }}/Python-{{ item.version }}.tgz" + dest: "{{ python_build_dir }}/python-{{ item.version }}.tgz" + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" when: not python_download.stat.exists - - name: 'extract python {{ item.version }} sources' + - name: "Extract python {{ item.version }} sources" become: true - unarchive: - src: '{{ python_build_dir }}/python-{{ item.version }}.tgz' - dest: '{{ python_build_dir }}' - include: 'Python-{{ item.version }}' + ansible.builtin.unarchive: + src: "{{ python_build_dir }}/python-{{ item.version }}.tgz" + dest: "{{ python_build_dir }}" + include: "Python-{{ item.version }}" - - name: rename source directory + - name: Rename source directory become: true - ansible.builtin.command: 'mv {{ python_build_dir}}/Python-{{ item.version }} {{ python_build_dir }}/{{ item.path }}' + ansible.builtin.command: "mv {{ python_build_dir}}/Python-{{ item.version }} {{ python_build_dir }}/{{ item.path }}" - - name: set correct permissions + - name: Set correct permissions become: true - file: - path: '{{ python_build_dir }}/{{ item.path }}' + ansible.builtin.file: + path: "{{ python_build_dir }}/{{ item.path }}" recurse: true - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_id }}' + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" state: directory - - name: configure build - ansible.builtin.command: 'sh ./configure --prefix={{ python_install_dir }}/{{ item.path }}' + - name: Configure build + ansible.builtin.command: "sh ./configure --prefix={{ python_install_dir }}/{{ item.path }}" args: - chdir: '{{ python_build_dir }}/{{ item.path }}/' + chdir: "{{ python_build_dir }}/{{ item.path }}/" - - name: make build - ansible.builtin.command: 'make' + - name: Make build + ansible.builtin.command: "make" args: - chdir: '{{ python_build_dir }}/{{ item.path }}/' + chdir: "{{ python_build_dir }}/{{ item.path }}/" - - name: install build + - name: Install build become: true - ansible.builtin.command: 'make install' + ansible.builtin.command: "make install" args: - chdir: '{{ python_build_dir }}/{{ item.path }}/' + chdir: "{{ python_build_dir }}/{{ item.path }}/" - - name: 'create symlink for python {{ item.version }}' + - name: "Create symlink for python {{ item.version }}" become: true - file: - src: '{{ python_install_dir }}/{{ item.path }}/bin/{{ item.binary }}' - dest: '/usr/bin/{{ item.binary }}' + ansible.builtin.file: + src: "{{ python_install_dir }}/{{ item.path }}/bin/{{ item.binary }}" + dest: "/usr/bin/{{ item.binary }}" state: link - when: python_installed.rc not in [ 0 ] diff --git a/tasks/debian/neovim.yml b/tasks/debian/neovim.yml index 939a741..a9cd4b4 100644 --- a/tasks/debian/neovim.yml +++ b/tasks/debian/neovim.yml @@ -1,7 +1,8 @@ +--- - name: Install language servers on debian hosts become: true community.general.npm: - name: '{{ item }}' + name: "{{ item }}" global: true loop: '{{ language_servers | map(attribute="package") | list }}' @@ -9,16 +10,16 @@ become: true ansible.builtin.file: state: directory - path: '{{ neovim.install_path }}' - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_gid }}' - mode: '0755' + path: "{{ neovim.install_path }}" + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_gid }}" + mode: "0755" - name: Register the current neovim version ansible.builtin.command: argv: - - '{{ neovim.install_path }}/bin/nvim' - - '--version' + - "{{ neovim.install_path }}/bin/nvim" + - "--version" register: neovim_stats changed_when: false ignore_errors: true @@ -30,21 +31,21 @@ - name: Download neovim {{ neovim.version }} ansible.builtin.get_url: - url: 'https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux-x86_64.tar.gz' + url: "https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux-x86_64.tar.gz" dest: /tmp/nvim-linux64.tar.gz - mode: '0755' - checksum: '{{ neovim.download_checksum }}' + mode: "0755" + checksum: "{{ neovim.download_checksum }}" when: neovim_stats.rc > 0 or neovim_installed_version != neovim.version register: neovim_download - name: Extract downloaded neovim version ansible.builtin.unarchive: src: /tmp/nvim-linux64.tar.gz - dest: '{{ neovim.install_path }}' + dest: "{{ neovim.install_path }}" extra_opts: - - '--strip-components=1' - - '--show-stored-names' - - '--overwrite' + - "--strip-components=1" + - "--show-stored-names" + - "--overwrite" when: | neovim_download.state == 'file' and (neovim_installed_version is undefined or neovim_installed_version != neovim.version) @@ -52,6 +53,6 @@ - name: Add neovim to PATH become: true ansible.builtin.template: - src: 'templates/debian/nvim.profile.j2' - dest: '/etc/profile.d/neovim.sh' - mode: '0755' + src: "templates/debian/nvim.profile.j2" + dest: "/etc/profile.d/neovim.sh" + mode: "0755" diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index b8c40e6..470bda9 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -1,69 +1,70 @@ +--- - name: Clone dotfiles ansible.builtin.git: - repo: '{{ dotfiles_repo }}' - dest: '{{ ansible_env.HOME }}/dotfiles' + repo: "{{ dotfiles_repo }}" + dest: "{{ ansible_env.HOME }}/dotfiles" version: master update: true - name: Create xdg configuration directories ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: directory - mode: '0755' + mode: "0755" loop: - - '{{ xdg_config_dir }}/git' - - '{{ xdg_config_dir }}/tmux' + - "{{ xdg_config_dir }}/git" + - "{{ xdg_config_dir }}/tmux" - name: Remove previous dotfiles ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: absent loop: - - '{{ ansible_env.HOME }}/.tmux.conf' - - '{{ ansible_env.HOME }}/.gitconfig' + - "{{ ansible_env.HOME }}/.tmux.conf" + - "{{ ansible_env.HOME }}/.gitconfig" - name: Setup dotfiles ansible.builtin.file: - path: '{{ item.dest }}' - src: '{{ item.src }}' + path: "{{ item.dest }}" + src: "{{ item.src }}" state: link force: true loop: - - src: '{{ ansible_env.HOME }}/dotfiles/.vimrc' - dest: '{{ ansible_env.HOME }}/.vimrc' + - src: "{{ ansible_env.HOME }}/dotfiles/.vimrc" + dest: "{{ ansible_env.HOME }}/.vimrc" - - src: '{{ ansible_env.HOME }}/dotfiles/.bashrc' - dest: '{{ ansible_env.HOME }}/.bashrc' + - src: "{{ ansible_env.HOME }}/dotfiles/.bashrc" + dest: "{{ ansible_env.HOME }}/.bashrc" - - src: '{{ ansible_env.HOME }}/dotfiles/.profile' - dest: '{{ ansible_env.HOME }}/.profile' + - src: "{{ ansible_env.HOME }}/dotfiles/.profile" + dest: "{{ ansible_env.HOME }}/.profile" - - src: '{{ ansible_env.HOME }}/dotfiles/tmux/tmux.conf' - dest: '{{ xdg_config_dir }}/tmux/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/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/tmux/dark.conf" + dest: "{{ xdg_config_dir }}/tmux/dark.conf" - - src: '{{ ansible_env.HOME }}/dotfiles/.gitignore' - dest: '{{ xdg_config_dir }}/git/ignore' + - src: "{{ ansible_env.HOME }}/dotfiles/.gitignore" + dest: "{{ xdg_config_dir }}/git/ignore" - name: Copy git configuration ansible.builtin.template: - src: 'templates/gitconfig.j2' - dest: '{{ xdg_config_dir }}/git/config' - mode: '0755' + src: "templates/gitconfig.j2" + dest: "{{ xdg_config_dir }}/git/config" + mode: "0755" - name: Create script directory ansible.builtin.file: - path: '{{ ansible_env.HOME }}/.local/bin' + path: "{{ ansible_env.HOME }}/.local/bin" state: directory - mode: '0755' + 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' + src: "templates/tmux-toggle.j2" + dest: "{{ ansible_env.HOME }}/.local/bin/tmux-toggle.sh" + mode: "0755" diff --git a/tasks/neovim.yml b/tasks/neovim.yml index 6bdbe68..3303d3a 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -1,3 +1,4 @@ +--- - name: Ensure neovim configuration directories exist ansible.builtin.file: path: "{{ item }}" From f7839aec33b67232185640ddb1c239bb0e7be82e Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 16 Jan 2026 10:21:23 +0100 Subject: [PATCH 36/36] Add markdown & rst packages and add esbonio configuration --- group_vars/arch/neovim.yml | 2 +- group_vars/arch/system.yml | 2 ++ templates/nvim/lua/lsp.lua.j2 | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/group_vars/arch/neovim.yml b/group_vars/arch/neovim.yml index debc75b..ef6fb27 100644 --- a/group_vars/arch/neovim.yml +++ b/group_vars/arch/neovim.yml @@ -26,7 +26,7 @@ language_servers: - package: esbonio server_name: "esbonio" - auto_setup: true + auto_setup: false - package: lua-language-server server_name: "lua_ls" diff --git a/group_vars/arch/system.yml b/group_vars/arch/system.yml index 0d2feef..0de7041 100644 --- a/group_vars/arch/system.yml +++ b/group_vars/arch/system.yml @@ -22,3 +22,5 @@ packages: - which - gcc - make + - esbonio + - marksman diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index f9d4202..83c1adc 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -103,6 +103,12 @@ vim.lsp.config['lua_ls'] = { } } +-- Use system binary for esbonio +vim.lsp.config['esbonio'] = { + on_attach = on_attach, + capabilities = capabilities, + cmd = { '/usr/bin/esbonio' } +} {% endif %} vim.lsp.config['yamlls'] = { on_attach = on_attach,