summaryrefslogtreecommitdiffstats
path: root/common/vim.nix
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2023-01-13 16:14:16 +0100
committerMinijackson <minijackson@riseup.net>2023-01-13 16:14:16 +0100
commit087b8756a6113c78ae20ee00c96c38f5922287a0 (patch)
tree6df92422691e3a70071ec7d6cbf3bc2707746c94 /common/vim.nix
parent91d534f926c4dbbe0814f2cfeea0c85c4f34ba0c (diff)
downloadnixos-config-reborn-087b8756a6113c78ae20ee00c96c38f5922287a0.tar.gz
nixos-config-reborn-087b8756a6113c78ae20ee00c96c38f5922287a0.zip
vim: fmt, remove polyglot, add impatient
Diffstat (limited to 'common/vim.nix')
-rw-r--r--common/vim.nix233
1 files changed, 112 insertions, 121 deletions
diff --git a/common/vim.nix b/common/vim.nix
index cb83a96..2f36958 100644
--- a/common/vim.nix
+++ b/common/vim.nix
@@ -1,53 +1,51 @@
1inputs: 1inputs: {
2 2 config,
3{ config, pkgs, lib, ... }: 3 pkgs,
4 4 lib,
5let 5 ...
6}: let
6 inherit (pkgs.unstable) vimPlugins wrapNeovim tree-sitter; 7 inherit (pkgs.unstable) vimPlugins wrapNeovim tree-sitter;
7 8
8 luaFormat = inputs.self.lib.generators.lua { }; 9 luaFormat = inputs.self.lib.generators.lua {};
9 10
10 neovim-unwrapped = pkgs.unstable.neovim-unwrapped; 11 neovim-unwrapped = pkgs.unstable.neovim-unwrapped;
11 12
12 cfg = config.vim; 13 cfg = config.vim;
13 14
14 myConfigPackage = 15 myConfigPackage = with lib; let
15 with lib; 16 config = ''
16 let config = 17 -- Autogenerated variables from the NixOS configuration
17 ''
18 -- Autogenerated variables from the NixOS configuration
19 18
20 ${(concatStringsSep 19 ${(concatStringsSep
21 "\n" 20 "\n"
22 (mapAttrsToList 21 (mapAttrsToList
23 (variable: value: "vim.g.${variable} = ${luaFormat.generate value}") 22 (variable: value: "vim.g.${variable} = ${luaFormat.generate value}")
24 cfg.variables))} 23 cfg.variables))}
25 24
26 -- vim.lua from the NixOS configuration 25 -- vim.lua from the NixOS configuration
27 26
28 ${builtins.readFile ../dotfiles/vim.lua} 27 ${builtins.readFile ../dotfiles/vim.lua}
29 28
30 -- luaConfig from the NixOS configuration 29 -- luaConfig from the NixOS configuration
31 30
32 ${cfg.luaConfig} 31 ${cfg.luaConfig}
33 ''; 32 '';
34 in 33 in
35 pkgs.runCommand 34 pkgs.runCommand
36 "myConfig" 35 "myConfig"
37 { 36 {
38 pname = "myConfig"; 37 pname = "myConfig";
39 inherit config; 38 inherit config;
40 passAsFile = [ "config" ]; 39 passAsFile = ["config"];
41 runLocal = true; 40 runLocal = true;
42 } 41 }
43 '' 42 ''
44 mkdir -p "$out/lua" 43 mkdir -p "$out/lua"
45 mv "$configPath" "$out/lua/myConfig.lua" 44 mv "$configPath" "$out/lua/myConfig.lua"
46 ''; 45 '';
47 46
48 myNeovim = wrapNeovim neovim-unwrapped { 47 myNeovim = wrapNeovim neovim-unwrapped {
49 configure = { 48 configure = {
50
51 inherit (config.vim) beforePlugins; 49 inherit (config.vim) beforePlugins;
52 50
53 customRC = '' 51 customRC = ''
@@ -57,95 +55,95 @@ let
57 ''; 55 '';
58 56
59 packages.myVimPackage = with vimPlugins; { 57 packages.myVimPackage = with vimPlugins; {
60 start = [ 58 start =
61 myConfigPackage 59 [
62 60 myConfigPackage
63 # Dependencies 61
64 plenary-nvim 62 # Dependencies
65 popup-nvim 63 plenary-nvim
66 64 popup-nvim
67 # UI 65
68 undotree 66 # UI
69 gruvbox-community 67 undotree
70 lualine-nvim 68 gruvbox-community
71 lualine-lsp-progress 69 lualine-nvim
72 gitsigns-nvim 70 lualine-lsp-progress
73 diffview-nvim 71 gitsigns-nvim
74 nvim-notify 72 diffview-nvim
75 indent-blankline-nvim 73 nvim-notify
76 74 indent-blankline-nvim
77 # Completion 75
78 nvim-cmp 76 # Completion
79 cmp-buffer 77 nvim-cmp
80 cmp-calc 78 cmp-buffer
81 cmp-cmdline 79 cmp-calc
82 cmp-latex-symbols 80 cmp-cmdline
83 cmp-nvim-lsp 81 cmp-latex-symbols
84 cmp-path 82 cmp-nvim-lsp
85 cmp-spell 83 cmp-path
86 cmp-tmux 84 cmp-spell
87 cmp-treesitter 85 cmp-tmux
88 cmp-vsnip 86 cmp-treesitter
89 87 cmp-vsnip
90 # Snippets 88
91 vim-vsnip 89 # Snippets
92 vim-vsnip-integ 90 vim-vsnip
93 91 vim-vsnip-integ
94 # Telescope 92
95 telescope-nvim 93 # Telescope
96 telescope-file-browser-nvim 94 telescope-nvim
97 telescope-ui-select-nvim 95 telescope-file-browser-nvim
98 96 telescope-ui-select-nvim
99 # Treesitter 97
100 nvim-treesitter.withAllGrammars 98 # Treesitter
101 nvim-treesitter-textobjects 99 nvim-treesitter.withAllGrammars
102 nvim-treesitter-context 100 nvim-treesitter-textobjects
103 nvim-treesitter-refactor 101 nvim-treesitter-context
104 102 nvim-treesitter-refactor
105 vim-matchup 103
106 104 vim-matchup
107 # Motions 105
108 camelcasemotion 106 # Motions
109 vim-surround 107 camelcasemotion
110 targets-vim 108 vim-surround
111 109 targets-vim
112 neoformat 110
113 111 neoformat
114 # Languages 112
115 vim-polyglot 113 # Languages
116 editorconfig-nvim 114 editorconfig-nvim
117 vim-pandoc 115 vim-pandoc
118 # Fixes "duplicated vim plugin" issue 116 # Fixes "duplicated vim plugin" issue
119 (refactoring-nvim.overrideAttrs (old: { dependencies = []; })) 117 (refactoring-nvim.overrideAttrs (old: {dependencies = [];}))
120 118
121 # Other 119 # Other
122 tmux-complete-vim 120 comment-nvim
123 vim-fugitive 121 impatient-nvim
124 vim-rhubarb 122 null-ls-nvim
125 vim-repeat 123 tabular
126 vim-unimpaired 124 tmux-complete-vim
127 tabular 125 vim-abolish
128 vim-abolish 126 vim-fugitive
129 vim-oscyank 127 vim-oscyank
130 comment-nvim 128 vim-repeat
131 null-ls-nvim 129 vim-rhubarb
132 ] ++ config.vim.extraPlugins; 130 vim-unimpaired
131 ]
132 ++ config.vim.extraPlugins;
133 }; 133 };
134 }; 134 };
135 }; 135 };
136in 136in {
137{
138 options.vim = with lib; { 137 options.vim = with lib; {
139
140 variables = mkOption { 138 variables = mkOption {
141 type = types.attrsOf luaFormat.type; 139 type = types.attrsOf luaFormat.type;
142 default = { }; 140 default = {};
143 description = "Extra global variables to add at the beginning of the vim configuration."; 141 description = "Extra global variables to add at the beginning of the vim configuration.";
144 }; 142 };
145 143
146 extraPlugins = mkOption { 144 extraPlugins = mkOption {
147 type = with types; listOf package; 145 type = with types; listOf package;
148 default = [ ]; 146 default = [];
149 description = "Names of extra plugins to add"; 147 description = "Names of extra plugins to add";
150 }; 148 };
151 149
@@ -200,14 +198,7 @@ in
200 NEOVIDE_MULTIGRID = "1"; 198 NEOVIDE_MULTIGRID = "1";
201 }; 199 };
202 200
203 home-manager.users.minijackson = { ... }: 201 home-manager.users.minijackson.xdg.dataFile."nvim/backup/.keep".text = "";
204 { 202 home-manager.users.root.xdg.dataFile."nvim/backup/.keep".text = "";
205 xdg.dataFile."nvim/backup/.keep".text = "";
206 };
207
208 home-manager.users.root = { ... }:
209 {
210 xdg.dataFile."nvim/backup/.keep".text = "";
211 };
212 }; 203 };
213} 204}