-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneovim.nix
267 lines (244 loc) · 6.86 KB
/
neovim.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
{ config, pkgs, lib, ... }:
{
home.packages = with pkgs; [
nerdfonts
# Language servers for neovim
nodePackages.vim-language-server
nodePackages.bash-language-server
nodePackages.pyright
nodePackages.yaml-language-server
nodePackages.typescript
nodePackages.typescript-language-server
terraform-ls
rnix-lsp
sumneko-lua-language-server
omnisharp-roslyn
gopls
jsonnet-language-server
# Debuggers
netcoredbg
];
programs.neovim = {
enable = true;
withNodeJs = true;
withPython3 = true;
extraPython3Packages = (ps: with ps; [ ]);
plugins = with pkgs.myVimPlugins; with pkgs.vimPlugins; [
# Dependencies used by other plugins
plenary-nvim
nui-nvim
# Visual config/colorscheme
{
plugin = tokyonight;
config = ''
colorscheme tokyonight
'';
}
nvim-web-devicons
{
plugin = lualine-nvim;
config = ''
lua require('lualine').setup()
'';
}
{
plugin = bufferline-nvim;
config = ''
lua <<EOF
vim.opt.termguicolors = true
require("bufferline").setup()
EOF
'';
}
nvim-notify
{
plugin = noice-nvim;
config = ''
lua <<EOF
require('noice').setup({
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
-- TODO: Update nixpkgs for this to work
--presets = {
-- lsp_doc_border = true,
--},
},
})
EOF
'';
}
# TODO: Arg highlighting: https://github.com/m-demare/hlargs.nvim
# TODO: Extra plugins
# - https://github.com/Chaitanyabsprip/present.nvim
# - https://github.com/folke/twilight.nvim
# - https://github.com/folke/zen-mode.nvim
# - https://github.com/goolord/alpha-nvim
# Neovim lua configuration
neodev-nvim
# LSP
nvim-lspconfig
cmp-nvim-lsp
nvim-cmp
cmp-buffer
luasnip
cmp_luasnip
{
plugin = copilot-lua;
config = ''
lua <<EOF
require('copilot').setup({
filetypes = {
yaml = true,
}
})
EOF
'';
}
{
plugin = copilot-cmp;
config = ''
lua require('copilot_cmp').setup()
'';
}
nvim-treesitter.withAllGrammars # TODO: Might be excessive to install all, but convenient
nvim-treesitter-textobjects
# Telescope
telescope-nvim
{
plugin = telescope-ui-select-nvim;
config = ''
lua require('telescope').load_extension('ui-select');
'';
}
{
plugin = telescope-fzf-native-nvim;
config = ''
lua require('telescope').load_extension('fzf')
'';
}
# Diagnostics
trouble-nvim
# Navigation
tmux-navigator
# Utilities
{
plugin = nvim-surround;
config = ''
lua require('nvim-surround').setup {}
'';
}
{
plugin = text-case-nvim;
# TODO: consider Telescope integration
config = ''
lua require('textcase').setup {}
'';
}
# TODO: https://github.com/smjonas/inc-rename.nvim
# Test compatability with text-case
{
plugin = nvim-lightbulb;
config = ''
lua require('nvim-lightbulb').setup({autocmd = {enabled = true}})
'';
}
{
plugin = which-key-nvim;
config = ''
lua require('which-key').setup {}
'';
}
{
plugin = gitsigns-nvim;
# TODO: Copy paste from gitsigns, move/change?
config = ''
lua <<EOF
require('gitsigns').setup {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
-- Actions
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
map('n', '<leader>tb', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function() gs.diffthis('~') end)
map('n', '<leader>td', gs.toggle_deleted)
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end
}
EOF
'';
}
# TODO: https://github.com/Shatur/neovim-session-manager
# Debuggers
nvim-dap
{ plugin = nvim-dap-ui; config = ''''; }
{ plugin = nvim-dap-virtual-text; config = ''''; }
# TODO: telescope-dap-nvim ?
# TODO: cmp-dap ?
/*
# tpope plugins
vim-repeat
vim-unimpaired
vim-fugitive
vim-eunuch
{
plugin = delimitMate;
config = ''
let g:delimitMate_expand_cr = 1
let g:delimitMate_expand_space = 0
let g:delimitMate_smart_matchpairs = 1
let g:delimitMate_balance_matchpairs = 1
'';
}
{
plugin = nerdtree;
config = ''
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=1
map <Leader>n :NERDTreeFind<CR>
'';
}
vim-nix
*/
];
extraConfig = ''
lua <<EOF
if not vim.g.vscode then
require("lsp")
require("config")
require("treesitter")
require("debugger")
end
EOF
'';
};
xdg.configFile."nvim/openapi-v3.0-draft-07.json".source = ./nvim/openapi-v3.0-draft-07.json;
xdg.configFile."nvim/lua".source = ./nvim/lua;
}