Skip to content

Commit 6e239f9

Browse files
authored
feat(modules/home-manager): begin to setup which-key (#46)
1 parent b91f340 commit 6e239f9

File tree

2 files changed

+201
-43
lines changed

2 files changed

+201
-43
lines changed

modules/home-manager/nixvim.nix

Lines changed: 198 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,6 @@
9595
backspace = "eol,start,indent";
9696
};
9797
keymaps = [
98-
# {
99-
# key = "<Space>";
100-
# action = "<NOP>";
101-
# }
102-
# {
103-
# key = "qq";
104-
# action = "<NOP>";
105-
# options = {
106-
# desc = "disable recording when I spaz out";
107-
# };
108-
# }
10998
{
11099
key = "<esc>";
111100
action = "<cmd>noh<CR>";
@@ -259,14 +248,20 @@
259248
desc = "no help";
260249
};
261250
}
251+
{
252+
key = "<leader>d";
253+
action = "<CMD>Neotree toggle<CR>";
254+
options = {
255+
desc = "toggle neotree";
256+
};
257+
}
262258
];
263259
plugins = {
264260
direnv.enable = lib.mkDefault true;
265261
commentary.enable = lib.mkDefault true;
266262
nvim-surround.enable = lib.mkDefault true;
267263
auto-save.enable = lib.mkDefault true;
268264
repeat.enable = lib.mkDefault true;
269-
which-key.enable = lib.mkDefault true;
270265
yanky.enable = lib.mkDefault true;
271266
hop.enable = lib.mkDefault true;
272267
wrapping.enable = lib.mkDefault true;
@@ -279,9 +274,14 @@
279274
# ui
280275
lualine.enable = lib.mkDefault true;
281276
luasnip.enable = lib.mkDefault true;
282-
neo-tree.enable = lib.mkDefault true;
277+
neo-tree = {
278+
enable = lib.mkDefault true;
279+
filesystem.followCurrentFile.enabled = lib.mkDefault true;
280+
};
283281
web-devicons.enable = lib.mkDefault true;
284282
todo-comments.enable = lib.mkDefault true;
283+
oil.enable = lib.mkDefault true;
284+
markview.enable = lib.mkDefault true;
285285

286286
blink-cmp = {
287287
enable = lib.mkDefault true;
@@ -349,34 +349,162 @@
349349
telescope = {
350350
enable = lib.mkDefault true;
351351
keymaps = {
352-
"<leader>p" = "live_grep";
353-
"<leader>pp" = "current_buffer_fuzzy_find";
354-
"<leader>pf" = "find_files";
355-
"<leader>pb" = "buffers";
356-
"<leader>n" = "tags";
357-
"<leader>pbt" = "current_buffer_tags";
358-
"<leader>phc" = "command_history";
359-
"<leader>phs" = "search_history";
360-
"<leader>phh" = "help_tags";
361-
"<leader>pq" = "quickfix";
352+
# grep
353+
"<leader>p" = {
354+
action = "live_grep";
355+
options = {
356+
desc = "find in file";
357+
};
358+
};
359+
"<leader>pp" = {
360+
action = "current_buffer_fuzzy_find";
361+
options = {
362+
desc = "find in buffer";
363+
};
364+
};
365+
366+
# files
367+
"<leader>f" = {
368+
action = "find_files";
369+
options = {
370+
desc = "find file";
371+
};
372+
};
373+
374+
# buffers
375+
"<leader>b" = {
376+
action = "find buffer";
377+
options = {
378+
desc = "find buffer";
379+
};
380+
};
381+
"<leader>bt" = {
382+
action = "current_buffer_tags";
383+
options = {
384+
desc = "find buffer tag";
385+
};
386+
};
387+
388+
"<leader>n" = {
389+
action = "tags";
390+
options = {
391+
desc = "find tag";
392+
};
393+
};
394+
"<leader>q" = {
395+
action = "quickfix";
396+
options = {
397+
desc = "find quickfix";
398+
};
399+
};
400+
401+
# history
402+
"<leader>phc" = {
403+
action = "command_history";
404+
options = {
405+
desc = "find command history";
406+
};
407+
};
408+
"<leader>phs" = {
409+
action = "search_history";
410+
options = {
411+
desc = "find search history";
412+
};
413+
};
414+
"<leader>phh" = {
415+
action = "help_tags";
416+
options = {
417+
desc = "find help tag";
418+
};
419+
};
362420

363421
# git
364-
"<leader>pg" = "git_files";
365-
"<leader>pgc" = "git_commits";
366-
"<leader>pgbc" = "git_bcommits";
367-
"<leader>pgs" = "git_status";
368-
"<leader>pgb" = "git_branches";
369-
"<leader>ctt" = "treesitter";
422+
"<leader>g" = {
423+
action = "git_files";
424+
options = {
425+
desc = "find git file";
426+
};
427+
};
428+
"<leader>gc" = {
429+
action = "git_commits";
430+
options = {
431+
desc = "find git commit";
432+
};
433+
};
434+
"<leader>gbc" = {
435+
action = "git_bcommits";
436+
options = {
437+
desc = "find git bcommits";
438+
};
439+
};
440+
"<leader>gb" = {
441+
action = "git_branches";
442+
options = {
443+
desc = "find git branches";
444+
};
445+
};
446+
"<leader>gs" = {
447+
action = "git_status";
448+
options = {
449+
desc = "find git status";
450+
};
451+
};
452+
"<leader>ctt" = {
453+
action = "treesitter";
454+
options = {
455+
desc = "find treesitter";
456+
};
457+
};
370458

371459
# lsp
372-
"<leader>cr" = "lsp_references";
373-
"<leader>cci" = "lsp_incoming_calls";
374-
"<leader>cco" = "lsp_outgoing_calls";
375-
"<leader>cs" = "lsp_document_symbols";
376-
"<leader>cws" = "lsp_workspace_symbols";
377-
"<leader>ci" = "lsp_implementations";
378-
"<leader>cd" = "lsp_definitions";
379-
"<leader>ct" = "lsp_type_definitions";
460+
"<leader>cr" = {
461+
action = "lsp_references";
462+
options = {
463+
desc = "code references";
464+
};
465+
};
466+
"<leader>cci" = {
467+
action = "lsp_incoming_calls";
468+
options = {
469+
desc = "code incoming calls";
470+
};
471+
};
472+
"<leader>cco" = {
473+
action = "lsp_outgoing_calls";
474+
options = {
475+
desc = "code outgoing calls";
476+
};
477+
};
478+
"<leader>cs" = {
479+
action = "lsp_document_symbols";
480+
options = {
481+
desc = "code document symbols";
482+
};
483+
};
484+
"<leader>cws" = {
485+
action = "lsp_workspace_symbols";
486+
options = {
487+
desc = "code workspace symbols";
488+
};
489+
};
490+
"<leader>ci" = {
491+
action = "lsp_implementations";
492+
options = {
493+
desc = "code implementations";
494+
};
495+
};
496+
"<leader>cd" = {
497+
action = "lsp_definitions";
498+
options = {
499+
desc = "code definitions";
500+
};
501+
};
502+
"<leader>ct" = {
503+
action = "lsp_type_definitions";
504+
options = {
505+
desc = "code type definitions";
506+
};
507+
};
380508
};
381509
};
382510

@@ -396,8 +524,6 @@
396524
};
397525
};
398526

399-
markview.enable = lib.mkDefault true;
400-
401527
# treesitter
402528
treesitter-context = {
403529
enable = lib.mkDefault true;
@@ -427,6 +553,39 @@
427553
yaml
428554
];
429555
};
556+
557+
which-key = {
558+
enable = lib.mkDefault true;
559+
settings = {
560+
replace = {
561+
desc = [
562+
[
563+
"<space>"
564+
"SPACE"
565+
]
566+
[
567+
"<leader>"
568+
"SPACE"
569+
]
570+
[
571+
"<[cC][rR]>"
572+
"RETURN"
573+
]
574+
[
575+
"<[tT][aA][bB]>"
576+
"TAB"
577+
]
578+
[
579+
"<[bB][sS]>"
580+
"BACKSPACE"
581+
]
582+
];
583+
};
584+
win = {
585+
border = "single";
586+
};
587+
};
588+
};
430589
# autoCmd = [
431590
# # Remove trailing whitespace on save
432591
# (lib.mkIf (!lib.elem "trim_whitespace" config.plugins.conform-nvim.settings.formatters_by_ft."_") {

modules/nixvim/default.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,13 @@
246246
}
247247
];
248248
plugins = {
249-
direnv.enable = lib.mkDefault true;
249+
auto-save.enable = lib.mkDefault true;
250250
commentary.enable = lib.mkDefault true;
251+
direnv.enable = lib.mkDefault true;
252+
hop.enable = lib.mkDefault true;
251253
nvim-surround.enable = lib.mkDefault true;
252-
auto-save.enable = lib.mkDefault true;
253254
repeat.enable = lib.mkDefault true;
254-
which-key.enable = lib.mkDefault true;
255255
yanky.enable = lib.mkDefault true;
256-
hop.enable = lib.mkDefault true;
257256

258257
# git
259258
fugitive.enable = lib.mkDefault true;

0 commit comments

Comments
 (0)