From e6f25d9fac301c83c92c10f3e8c338b8342ba109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Tue, 31 Oct 2023 22:26:01 +0100 Subject: [PATCH] nix: Even more vim plugins! --- .../roles/vim/templates/pluginlist.j2 | 24 ------- .../roles/vim/templates/plugins/abolish.j2 | 2 - .../roles/vim/templates/plugins/easy_align.j2 | 4 -- .../roles/vim/templates/plugins/gutentags.j2 | 3 - .../vim/templates/plugins/quick_scope.j2 | 2 - .../roles/vim/templates/plugins/registers.j2 | 2 - .../roles/vim/templates/plugins/shot_f.j2 | 2 - .../roles/vim/templates/plugins/surround.j2 | 2 - .../roles/vim/templates/plugins/targets.j2 | 2 - config/nix/hm/vim.nix | 67 ++++++++++++++++++- .../hm/vim/symbols-outline-nvim.lua} | 9 +-- 11 files changed, 65 insertions(+), 54 deletions(-) delete mode 100644 config/automatrop/roles/vim/templates/plugins/abolish.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/easy_align.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/gutentags.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/quick_scope.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/registers.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/shot_f.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/surround.j2 delete mode 100644 config/automatrop/roles/vim/templates/plugins/targets.j2 rename config/{automatrop/roles/vim/templates/plugins/symbols-outline.j2 => nix/hm/vim/symbols-outline-nvim.lua} (69%) diff --git a/config/automatrop/roles/vim/templates/pluginlist.j2 b/config/automatrop/roles/vim/templates/pluginlist.j2 index 1706c64..277cc90 100644 --- a/config/automatrop/roles/vim/templates/pluginlist.j2 +++ b/config/automatrop/roles/vim/templates/pluginlist.j2 @@ -16,30 +16,6 @@ " Theme source ~/.config/vim/theme.vim -" Search/replace -{{ use_plugin('abolish') }} -{{ use_plugin('easy_align') }} - -" Sourounding pairs -{{ use_plugin('surround') }} -{{ use_plugin('targets') }} - -" f/F mode -{{ use_plugin('shot_f') }} -{{ use_plugin('quick_scope') }} - -" Registers -{{ use_plugin('registers') }} - - -" Tags/Symbols -{{ use_plugin('gutentags') }} -{% if variant == 'nvim' %} -{{ use_plugin('symbols-outline') }} -{% else %} -{{ use_plugin('vista') }} -{% endif %} - " Language Server Client {% if variant == 'nvim' %} {{ use_plugin('nvim_lspconfig') }} diff --git a/config/automatrop/roles/vim/templates/plugins/abolish.j2 b/config/automatrop/roles/vim/templates/plugins/abolish.j2 deleted file mode 100644 index 3a5f5d4..0000000 --- a/config/automatrop/roles/vim/templates/plugins/abolish.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{# Regex for words, with case in mind #} -{{ add_source('tpope/tpope-vim-abolish') -}} diff --git a/config/automatrop/roles/vim/templates/plugins/easy_align.j2 b/config/automatrop/roles/vim/templates/plugins/easy_align.j2 deleted file mode 100644 index c5fe06d..0000000 --- a/config/automatrop/roles/vim/templates/plugins/easy_align.j2 +++ /dev/null @@ -1,4 +0,0 @@ -{# Aligning lines around a certain character #} -{{ add_source('junegunn/vim-easy-align') -}} -" Align GitHub-flavored Markdown tables -au FileType markdown vmap :EasyAlign* diff --git a/config/automatrop/roles/vim/templates/plugins/gutentags.j2 b/config/automatrop/roles/vim/templates/plugins/gutentags.j2 deleted file mode 100644 index 28dd01b..0000000 --- a/config/automatrop/roles/vim/templates/plugins/gutentags.j2 +++ /dev/null @@ -1,3 +0,0 @@ -{# Generate tags #} -{{ add_source('ludovicchabant/vim-gutentags') -}} -let g:gutentags_cache_dir = expand('~/.cache/{{ variant }}/tags') diff --git a/config/automatrop/roles/vim/templates/plugins/quick_scope.j2 b/config/automatrop/roles/vim/templates/plugins/quick_scope.j2 deleted file mode 100644 index 8e0692f..0000000 --- a/config/automatrop/roles/vim/templates/plugins/quick_scope.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{# Auto-highlight one character per word for quick f/F movement #} -{{ add_source('unblevable/quick-scope') -}} diff --git a/config/automatrop/roles/vim/templates/plugins/registers.j2 b/config/automatrop/roles/vim/templates/plugins/registers.j2 deleted file mode 100644 index 04cf261..0000000 --- a/config/automatrop/roles/vim/templates/plugins/registers.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{# Show register content when pressing " #} -{{ add_source('tversteeg/registers.nvim') -}} diff --git a/config/automatrop/roles/vim/templates/plugins/shot_f.j2 b/config/automatrop/roles/vim/templates/plugins/shot_f.j2 deleted file mode 100644 index 20808d2..0000000 --- a/config/automatrop/roles/vim/templates/plugins/shot_f.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{# When in f/F/t/T mode, highlight in red the characters that can be jumped to #} -{{ add_source('deris/vim-shot-f') -}} diff --git a/config/automatrop/roles/vim/templates/plugins/surround.j2 b/config/automatrop/roles/vim/templates/plugins/surround.j2 deleted file mode 100644 index d4dfb9a..0000000 --- a/config/automatrop/roles/vim/templates/plugins/surround.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{# Change surroundings pairs (e.g. brackets, quotes… #} -{{ add_source('tpope/vim-surround') -}} diff --git a/config/automatrop/roles/vim/templates/plugins/targets.j2 b/config/automatrop/roles/vim/templates/plugins/targets.j2 deleted file mode 100644 index b9a7de7..0000000 --- a/config/automatrop/roles/vim/templates/plugins/targets.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{# Better interaction with surrounding pairs #} -{{ add_source('wellle/targets.vim') -}} diff --git a/config/nix/hm/vim.nix b/config/nix/hm/vim.nix index 90189db..19c7165 100644 --- a/config/nix/hm/vim.nix +++ b/config/nix/hm/vim.nix @@ -4,6 +4,28 @@ let url = "https://github.com/nix-community/nixvim"; ref = "nixos-23.05"; }); + vim-shot-f = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "vim-shot-f"; + version = "2016-02-05"; + src = pkgs.fetchFromGitHub { + owner = "deris"; + repo = "vim-shot-f"; + rev = "eea71d2a1038aa87fe175de9150b39dc155e5e7f"; + sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c="; + }; + meta.homepage = "https://github.com/deris/vim-shot-f"; + }; + quick-scope = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "quick-scope"; + version = "2.6.1"; + src = pkgs.fetchFromGitHub { + owner = "deris"; + repo = "quick-scope"; + rev = "2.6.1"; + sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c="; + }; + meta.homepage = "https://github.com/unblevable/quick-scope"; + }; in { imports = [ @@ -72,14 +94,50 @@ in overrideGenericSorter = true; }; }; + + # Surrounding pairs + surround.enable = true; # Change surrounding pairs (e.g. brackets, quotes) }; extraPlugins = with pkgs.vimPlugins; [ - nvim-scrollview + nvim-scrollview # Scroll bar # Status line - feline-nvim # TODO Abandonned. Maybe use lualine? + feline-nvim # Customizable status line. + # TODO Abandonned. Maybe use lualine? + + # Search/replace + vim-abolish # Regex for words, with case in mind + vim-easy-align # Aligning lines around a certain character + + # Surrounding pairs + targets-vim # Better interaction with surrounding pairs + + # f/F mode + vim-shot-f # Highlight relevant characters for f/F/t/T modes + quick-scope # Highlight relevant characters for f/F modes one per word but always + # FIXME Doesn't work here, :QuickScopeToggle doesn't even work + + # Registers + registers-nvim # Show register content when pressing " + # TODO Doesn't work. Didn't work on Arch either + + # Tags + vim-gutentags # Generate tags + symbols-outline-nvim # Show a symbol panel on the right + # TODO Fails on startup. Same on Arch. Config issue? + ]; + extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [ + ./vim/feline.lua + ./vim/symbols-outline-nvim.lua + ]; + extraConfigVim = '' + " vim-gutentags + let g:gutentags_cache_dir = expand('~/.cache/nvim/tags') + ''; + autoCmd = [ + # vim-easy-align: Align Markdown tables + { event = "FileType markdown"; command = "vmap :EasyAlign*"; } ]; - extraConfigLua = "${builtins.readFile ./vim/feline.lua}"; # 23.11: Use keymaps, seems better maps = { @@ -103,6 +161,9 @@ in normal."gb" = { action = "BufferPick"; silent = true; }; # TODO Other useful options? + # symbols-outline-nvim + normal."s" = { action = "SymbolsOutline"; silent = true; }; + }; }; } diff --git a/config/automatrop/roles/vim/templates/plugins/symbols-outline.j2 b/config/nix/hm/vim/symbols-outline-nvim.lua similarity index 69% rename from config/automatrop/roles/vim/templates/plugins/symbols-outline.j2 rename to config/nix/hm/vim/symbols-outline-nvim.lua index abbe040..4649eb7 100644 --- a/config/automatrop/roles/vim/templates/plugins/symbols-outline.j2 +++ b/config/nix/hm/vim/symbols-outline-nvim.lua @@ -1,9 +1,3 @@ -{# Show a symbol panel on the right #} -{{ add_source('simrat39/symbols-outline.nvim') -}} - -nmap s :SymbolsOutline - -lua << EOF vim.g.symbols_outline = { highlight_hovered_item = true, show_guides = true, @@ -22,5 +16,4 @@ vim.g.symbols_outline = { }, lsp_blacklist = {}, } -EOF -{# TODO Should be hierarchical, doesn't seem to be :/ #} +-- TODO Should be hierarchical, doesn't seem to be :/