diff options
author | Minijackson <minijackson@riseup.net> | 2020-12-03 16:45:06 +0100 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2020-12-03 16:45:06 +0100 |
commit | 3f0e83cb4816e637d8c916fb77217e1c5824dbe5 (patch) | |
tree | 65b48ffe6e82459cde97b8ee61a597402ba2617b /common/vim.nix | |
download | nixos-config-reborn-3f0e83cb4816e637d8c916fb77217e1c5824dbe5.tar.gz nixos-config-reborn-3f0e83cb4816e637d8c916fb77217e1c5824dbe5.zip |
initial commit: most of previous configuration reworked
Diffstat (limited to 'common/vim.nix')
-rw-r--r-- | common/vim.nix | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/common/vim.nix b/common/vim.nix new file mode 100644 index 0000000..ddb901a --- /dev/null +++ b/common/vim.nix | |||
@@ -0,0 +1,119 @@ | |||
1 | { config, pkgs, lib, ... }: | ||
2 | |||
3 | let myNeovim = (pkgs.neovim.override { | ||
4 | configure = { | ||
5 | |||
6 | inherit (config.vim) beforePlugins; | ||
7 | |||
8 | customRC = with lib; | ||
9 | (concatStringsSep | ||
10 | "\n" | ||
11 | (mapAttrsToList | ||
12 | (variable: value: "let g:${variable} = ${value}") | ||
13 | config.vim.variables)) | ||
14 | + "\n" | ||
15 | + builtins.readFile ../dotfiles/vimrc.vim + config.vim.extraConfig; | ||
16 | |||
17 | vam = with pkgs; { | ||
18 | pluginDictionaries = [ | ||
19 | # UI | ||
20 | { name = "undotree"; } | ||
21 | { name = "gruvbox-community"; } | ||
22 | { name = "gitgutter"; } | ||
23 | { name = "lightline-vim"; } | ||
24 | { name = "vim-dirvish"; } | ||
25 | |||
26 | # Motions | ||
27 | { name = "camelcasemotion"; } | ||
28 | { name = "surround"; } | ||
29 | { name = "targets-vim"; } | ||
30 | |||
31 | # Frameworks | ||
32 | { name = "deoplete-nvim"; } | ||
33 | { name = "neosnippet"; } | ||
34 | { name = "neosnippet-snippets"; } | ||
35 | { name = "neoformat"; } | ||
36 | { name = "ctrlp"; } | ||
37 | # Syntax generic completion for deoplete | ||
38 | { name = "neco-syntax"; } | ||
39 | |||
40 | # Languages | ||
41 | { name = "vim-polyglot"; } | ||
42 | { name = "editorconfig-vim"; } | ||
43 | # Vim completion for deoplete | ||
44 | { name = "neco-vim"; } | ||
45 | { name = "deoplete-zsh"; } | ||
46 | { name = "vim-pandoc"; } | ||
47 | { name = "vim-pandoc-syntax"; } | ||
48 | |||
49 | # Languages (but not programming languages) | ||
50 | { name = "vim-grammarous"; } | ||
51 | |||
52 | # Other | ||
53 | { name = "tmux-complete-vim"; } | ||
54 | { name = "fugitive"; } | ||
55 | { name = "rhubarb"; } | ||
56 | { name = "repeat"; } | ||
57 | { name = "vim-unimpaired"; } | ||
58 | { name = "tabular"; } | ||
59 | { name = "vimwiki"; } | ||
60 | { name = "vim-abolish"; } | ||
61 | |||
62 | ] ++ config.vim.extraPlugins; | ||
63 | |||
64 | }; | ||
65 | |||
66 | }; | ||
67 | }); | ||
68 | in { | ||
69 | options.vim = with lib; { | ||
70 | |||
71 | variables = mkOption { | ||
72 | type = types.attrsOf types.str; | ||
73 | default = { | ||
74 | dominant_color = "'${config.theme.colors.dominant}'"; | ||
75 | ripgrep_path = "'${pkgs.ripgrep}/bin/rg'"; | ||
76 | fd_path = "'${pkgs.fd}/bin/fd'"; | ||
77 | }; | ||
78 | description = '' | ||
79 | Extra global variables to add at the beginning of the vim configuration. | ||
80 | |||
81 | Remember to escape strings with single-quotes. | ||
82 | ''; | ||
83 | }; | ||
84 | |||
85 | extraPlugins = mkOption { | ||
86 | type = types.listOf (types.attrsOf types.str); | ||
87 | default = []; | ||
88 | description = "Names of extra plugins to add"; | ||
89 | }; | ||
90 | |||
91 | extraRepoPlugins = mkOption { | ||
92 | type = types.listOf (types.attrsOf types.str); | ||
93 | default = []; | ||
94 | description = "Names of extra plugins to add that are present in the local repository"; | ||
95 | }; | ||
96 | |||
97 | beforePlugins = mkOption { | ||
98 | type = types.lines; | ||
99 | default = ""; | ||
100 | description = "Extra lines to add in the vim configuration before loading plugins"; | ||
101 | }; | ||
102 | |||
103 | extraConfig = mkOption { | ||
104 | type = types.lines; | ||
105 | default = ""; | ||
106 | description = "Extra lines to add at the end of the vim configuration"; | ||
107 | }; | ||
108 | }; | ||
109 | |||
110 | config = { | ||
111 | environment.systemPackages = with pkgs; [ | ||
112 | myNeovim | ||
113 | ]; | ||
114 | |||
115 | environment.sessionVariables = { | ||
116 | EDITOR = "nvim"; | ||
117 | }; | ||
118 | }; | ||
119 | } | ||