From 70401e484afafcaae57ccd0aa8f0f675548774ea Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Mon, 11 Nov 2024 21:46:26 +0100 Subject: [PATCH] nix/neovim: switch to using nixvim and partially migrate --- nix/home-manager/programs/neovim.nix | 250 +++++++++++++++------------ 1 file changed, 143 insertions(+), 107 deletions(-) diff --git a/nix/home-manager/programs/neovim.nix b/nix/home-manager/programs/neovim.nix index e169eea..be7e02b 100644 --- a/nix/home-manager/programs/neovim.nix +++ b/nix/home-manager/programs/neovim.nix @@ -1,131 +1,167 @@ { + repoFlake, pkgs, lib, ... -}: let -in { - # FIXME: this doesn't work - home.sessionVariables.EDITOR = "nvim"; +}: { + imports = [ + repoFlake.inputs.nixvim.homeManagerModules.nixvim + ]; - programs.neovim = { + programs.nixvim = { enable = true; + defaultEditor = true; + vimdiffAlias = true; + vimAlias = true; extraPython3Packages = ps: with ps; []; - extraConfig = builtins.readFile ./neovim/vimrc; + # extraConfigVim = builtins.readFile ./neovim/vimrc; - plugins = with pkgs; - [ - # yaml-folds - { - plugin = vimUtils.buildVimPlugin { - name = "vim-yaml-folds"; - src = fetchFromGitHub { - owner = "pedrohdz"; - repo = "vim-yaml-folds"; - rev = "890ccd8e5370808d569e96dbb06cbeca2cf5993a"; - sha256 = "018z6xcwrq58q6lj6gwhrifjaxkmrlkkg0n86s6mjjlwkbs2qa4m"; - }; - buildInputs = [zip vim]; - }; - } + clipboard = { + register = "unnamedplus"; + providers.wl-copy.enable = true; + }; - { - plugin = vimUtils.buildVimPlugin { - name = "vim-yaml"; - src = fetchFromGitHub { - owner = "stephpy"; - repo = "vim-yaml"; - rev = "e97e063b16eba4e593d620676a0a15fa98613979"; - sha256 = "0vqahbrnr43lxanpziyrmzaqqb3cmyny8ry1xvmy2xyd1larzfrk"; - }; - }; - } + plugins = { + airline = { + enable = true; + settings = { + powerline_fonts = true; + skip_empty_sections = true; + theme = "papercolor"; + }; + }; + fugitive.enable = true; + gitblame.enable = true; + lsp = { + enable = true; + }; - # broken 2021-06-08 - # { - # plugin = vimUtils.buildVimPlugin { - # name = "vim-markdown-toc"; - # src = fetchFromGitHub { - # owner = "mzlogin"; - # repo = "vim-markdown-toc"; - # rev = "b7bb6c37033d3a6c93906af48dc0e689bd948638"; - # sha256 = "026xf2gid4qivwawh7if3nfk7zja9di0flhdzdx82lvil9x48lyz"; - # }; - # }; - # } + nix.enable = true; - # broken 2021-06-08 - # { - # plugin = vimUtils.buildVimPlugin { - # name = "vim-perl"; - # src = fetchFromGitHub { - # owner = "vim-perl"; - # repo = "vim-perl"; - # rev = "f330b5d474c44e6cfae22ba50868093dea3e9adb"; - # sha256 = "1dy40ixgixj0536c5ggra51b4yd1lbw4j6l0j5zc3diasb7m2gvr"; - # }; - # }; - # } + # TODO: enable in next release + # numbertoggle.enable = true; - { - plugin = vimUtils.buildVimPlugin { - name = "git-blame"; - src = fetchFromGitHub { - "owner" = "zivyangll"; - "repo" = "git-blame.vim"; - "rev" = "9d144b7bed5d8f1c9259551768b7f3b3d1294917"; - "sha256" = "06zb5xcc59k25rpwl46j82fcqckiznmj97v6i0mwlb8jhqqrhy9j"; - }; - }; - } - ] - ++ (with pkgs.vimPlugins; [ - delimitMate - vim-airline - vim-airline-themes - ctrlp - vim-css-color - rainbow_parentheses - vim-colorschemes - vim-colorstepper - vim-signify - fugitive - vim-indent-guides - UltiSnips - fzfWrapper + # successfor to ctrlp and fzf + telescope.enable = true; - ncm2 - ncm2-bufword - ncm2-path - ncm2-tmux - ncm2-ultisnips - nvim-yarp + todo-comments.enable = true; - LanguageClient-neovim + toggleterm.enable = true; - Improved-AnsiEsc - tabular + treesitter = { + enable = true; - # Nix - vim-addon-nix - tlib - vim-addon-vim2nix + grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + bash + json + lua + make + markdown + nix + regex + toml + vim + vimdoc + xml + yaml + ]; + }; - # LaTeX - vim-latex-live-preview - vimtex + treesitter-context.enable = true; + treesitter-refactor.enable = true; - # YAML - vim-yaml + # This plugin trims trailing whitespace and lines. + trim.enable = true; + }; - # markdown - vim-markdown - vim-markdown-toc + # plugins = with pkgs; + # [ + # # yaml-folds + # { + # plugin = vimUtils.buildVimPlugin { + # name = "vim-yaml-folds"; + # src = fetchFromGitHub { + # owner = "pedrohdz"; + # repo = "vim-yaml-folds"; + # rev = "890ccd8e5370808d569e96dbb06cbeca2cf5993a"; + # sha256 = "018z6xcwrq58q6lj6gwhrifjaxkmrlkkg0n86s6mjjlwkbs2qa4m"; + # }; + # buildInputs = [zip vim]; + # }; + # } - # misc syntax support - vim-bazel - maktaba - ]); + # { + # plugin = vimUtils.buildVimPlugin { + # name = "vim-yaml"; + # src = fetchFromGitHub { + # owner = "stephpy"; + # repo = "vim-yaml"; + # rev = "e97e063b16eba4e593d620676a0a15fa98613979"; + # sha256 = "0vqahbrnr43lxanpziyrmzaqqb3cmyny8ry1xvmy2xyd1larzfrk"; + # }; + # }; + # } + + # { + # plugin = vimUtils.buildVimPlugin { + # name = "git-blame"; + # src = fetchFromGitHub { + # "owner" = "zivyangll"; + # "repo" = "git-blame.vim"; + # "rev" = "9d144b7bed5d8f1c9259551768b7f3b3d1294917"; + # "sha256" = "06zb5xcc59k25rpwl46j82fcqckiznmj97v6i0mwlb8jhqqrhy9j"; + # }; + # }; + # } + # ] + # ++ (with pkgs.vimPlugins; [ + # delimitMate + # vim-airline + # vim-airline-themes + # ctrlp + # vim-css-color + # rainbow_parentheses + # vim-colorschemes + # vim-colorstepper + # vim-signify + # fugitive + # vim-indent-guides + # UltiSnips + # fzfWrapper + + # ncm2 + # ncm2-bufword + # ncm2-path + # ncm2-tmux + # ncm2-ultisnips + # nvim-yarp + + # LanguageClient-neovim + + # Improved-AnsiEsc + # tabular + + # # Nix + # vim-addon-nix + # tlib + # vim-addon-vim2nix + + # # LaTeX + # vim-latex-live-preview + # vimtex + + # # YAML + # vim-yaml + + # # markdown + # vim-markdown + # vim-markdown-toc + + # # misc syntax support + # vim-bazel + # maktaba + # ]); }; }