-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim.nix
175 lines (174 loc) · 4.2 KB
/
vim.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
pkgs,
pkgs_old,
lib,
...
}: let
treesitter = pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins:
with plugins; [
lua
cpp
c
cmake
nix
python
rust
bash
fish
latex
javascript
java
html
xml
json
yaml
toml
vimdoc
tmux
markdown
todotxt
terraform
just
thrift
hcl
dockerfile
commonlisp
(helm.overrideAttrs
(oldAttrs: {
src = pkgs.fetchFromGitHub {
owner = "ngalaiko";
repo = "tree-sitter-go-template";
rev = "ca52fbfc98366c585b84f4cb3745df49f33cd140";
hash = "sha256-ZWpzqKD3ceBzlsRjehXZgu+NZMbWyyK+/R1Ymg7DVkM=";
};
}))
]);
vimPlugins = with pkgs.vimPlugins; [
lazy-nvim
oil-nvim
nvim-tree-lua
telescope-nvim
telescope-live-grep-args-nvim
vim-rhubarb
copilot-vim
avante-nvim
comment-nvim
conform-nvim
nvim-lint
zen-mode-nvim
twilight-nvim
nvim-highlight-colors
gitsigns-nvim
vim-fugitive
flash-nvim
(pkgs.callPackage ./derivations/match-visual-nvim.nix {})
# for some reason old one has better startup time
pkgs_old.vimPlugins.auto-session
refactoring-nvim
# completion
nvim-cmp
cmp-nvim-lsp
luasnip
cmp_luasnip
cmp-path
neodev-nvim
nvim-lspconfig
# debugging
nvim-dap
nvim-dap-python
nvim-dap-ui
# TODO: change loading icon
fidget-nvim
nvim-notify
# -- theming
mini-nvim
noice-nvim
nvim-web-devicons
tokyonight-nvim
vscode-nvim
(import ./derivations/render-markdown-nvim.nix {inherit pkgs;})
todo-comments-nvim
treesitter
nvim-treesitter-textobjects
];
in {
programs.neovim = {
enable = true;
vimAlias = true;
extraLuaConfig = builtins.readFile ./dotfiles/nvim/extraLuaConfig.lua;
extraLuaPackages = luaPkgs: with luaPkgs; [nvim-nio pathlib-nvim];
plugins = vimPlugins;
extraPackages = with pkgs; [
wl-clipboard
stylua
black
eslint_d
alejandra
# language servers
lua-language-server
nixd
dockerfile-language-server-nodejs
pyright
yaml-language-server
neocmakelsp
nodePackages.bash-language-server
(pkgs.callPackage ./derivations/fish-lsp.nix {})
vscode-langservers-extracted
yaml-language-server
jdt-language-server
texlab
rust-analyzer
typescript-language-server
terraform-ls
#linters
pylint
yamllint
#
rustfmt
(python3.withPackages (python-pkgs: [python-pkgs.mdformat-gfm]))
];
};
home.file.".config/nvim/lua/nix_paths.lua".text = let
load_treesitters_body = lib.strings.concatStrings (lib.strings.intersperse "\n"
(
lib.lists.forEach treesitter.dependencies
(
parser: let
lang = lib.strings.removePrefix "vimplugin-treesitter-grammar-" parser.name;
in
/*
lua
*/
''vim.treesitter.language.add("${lang}", {path = "${parser}/parser/${lang}.so"})''
)
));
in
/*
lua
*/
''
return {
lazypath = "${pkgs.vimPlugins.lazy-nvim}",
load_treesitters = function ()
${load_treesitters_body}
end,
-- https://github.com/NixOS/nixpkgs/issues/264141
codelldb = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/.codelldb-wrapped_",
lldb_dap = "${pkgs.lldb}/bin/lldb-dap"
}
'';
xdg.configFile = let
nvim-spell-de-utf8-dictionary = builtins.fetchurl {
url = "http://ftp.vim.org/vim/runtime/spell/de.utf-8.spl";
sha256 = "sha256:1ld3hgv1kpdrl4fjc1wwxgk4v74k8lmbkpi1x7dnr19rldz11ivk";
};
# nvim-spell-de-utf8-suggestions = builtins.fetchurl {
# url = "http://ftp.vim.org/vim/runtime/spell/de.utf-8.sug";
# sha256 = "sha256:0j592ibsias7prm1r3dsz7la04ss5bmsba6l1kv9xn3353wyrl0k";
# };
in {
# TODO: move to ./vim.nix
"nvim/spell/de.utf-8.spl".source = nvim-spell-de-utf8-dictionary;
# "nvim/spell/de.utf-8.sug".source = nvim-spell-de-utf8-suggestions;
};
}