Nix flake configuration for my various machines (clients and homelab servers)
0

Configure Feed

Select the types of activity you want to include in your feed.

nixvim: add telescope, improve leader keybinds

Parthiv Krishna (Jun 22, 2026, 12:09 PM -0700) f3d815a2 a96b62ba

+253 -49
+7 -6
modules/features/apps/nixvim/default.nix
··· 99 99 } 100 100 # remove search highlight 101 101 { 102 - key = "<Leader>n"; 103 - action = ":noh<CR>"; 102 + key = "<Esc>"; 103 + action = "<cmd>noh<CR>"; 104 + mode = "n"; 104 105 } 105 - # vertical split 106 + # vertical split, matching tmux prefix | 106 107 { 107 - key = "<Leader>v"; 108 + key = "<Leader>|"; 108 109 action = ":vs<CR>"; 109 110 } 110 - # horizontal split 111 + # horizontal split, matching tmux prefix - 111 112 { 112 - key = "<Leader>h"; 113 + key = "<Leader>-"; 113 114 action = ":sv<CR>"; 114 115 } 115 116 ];
+49 -2
modules/features/apps/nixvim/git/fugitive.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.fugitive = { 3 - enable = true; 2 + programs.nixvim.config = { 3 + plugins.fugitive = { 4 + enable = true; 5 + }; 6 + 7 + keymaps = [ 8 + { 9 + mode = "n"; 10 + key = "<Leader>gs"; 11 + action = "<cmd>Git<CR>"; 12 + options.desc = "Git status"; 13 + } 14 + { 15 + mode = "n"; 16 + key = "<Leader>gc"; 17 + action = "<cmd>Git commit<CR>"; 18 + options.desc = "Git commit"; 19 + } 20 + { 21 + mode = "n"; 22 + key = "<Leader>gp"; 23 + action = "<cmd>Git push<CR>"; 24 + options.desc = "Git push"; 25 + } 26 + { 27 + mode = "n"; 28 + key = "<Leader>gP"; 29 + action = "<cmd>Git pull<CR>"; 30 + options.desc = "Git pull"; 31 + } 32 + { 33 + mode = "n"; 34 + key = "<Leader>gb"; 35 + action = "<cmd>Git blame<CR>"; 36 + options.desc = "Git blame"; 37 + } 38 + { 39 + mode = "n"; 40 + key = "<Leader>gd"; 41 + action = "<cmd>Gdiffsplit<CR>"; 42 + options.desc = "Git diff current file"; 43 + } 44 + { 45 + mode = "n"; 46 + key = "<Leader>gl"; 47 + action = "<cmd>Git log --oneline --decorate --graph --all<CR>"; 48 + options.desc = "Git log graph"; 49 + } 50 + ]; 4 51 }; 5 52 }
+63 -4
modules/features/apps/nixvim/git/gitsigns.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.gitsigns = { 3 - enable = true; 4 - settings = { 5 - current_line_blame = true; 2 + programs.nixvim.config = { 3 + plugins.gitsigns = { 4 + enable = true; 5 + settings = { 6 + current_line_blame = true; 7 + }; 6 8 }; 9 + 10 + keymaps = [ 11 + { 12 + mode = "n"; 13 + key = "<Leader>gj"; 14 + action = "<cmd>lua require('gitsigns').nav_hunk('next', { target = 'all' })<CR>"; 15 + options.desc = "Next git hunk"; 16 + } 17 + { 18 + mode = "n"; 19 + key = "<Leader>gk"; 20 + action = "<cmd>lua require('gitsigns').nav_hunk('prev', { target = 'all' })<CR>"; 21 + options.desc = "Previous git hunk"; 22 + } 23 + { 24 + mode = "n"; 25 + key = "<Leader>gh"; 26 + action = "<cmd>Gitsigns preview_hunk<CR>"; 27 + options.desc = "Preview git hunk"; 28 + } 29 + { 30 + mode = "n"; 31 + key = "<Leader>ga"; 32 + action = "<cmd>Gitsigns stage_hunk<CR>"; 33 + options.desc = "Stage/unstage git hunk"; 34 + } 35 + { 36 + mode = "n"; 37 + key = "<Leader>gu"; 38 + action = "<cmd>Gitsigns reset_hunk<CR>"; 39 + options.desc = "Undo git hunk"; 40 + } 41 + { 42 + mode = "n"; 43 + key = "<Leader>gr"; 44 + action = "<cmd>Gitsigns stage_hunk<CR>"; 45 + options.desc = "Reset/unstage git hunk"; 46 + } 47 + { 48 + mode = "n"; 49 + key = "<Leader>gA"; 50 + action = "<cmd>Gitsigns stage_buffer<CR>"; 51 + options.desc = "Stage current buffer"; 52 + } 53 + { 54 + mode = "n"; 55 + key = "<Leader>gR"; 56 + action = "<cmd>Gitsigns reset_buffer_index<CR>"; 57 + options.desc = "Reset/unstage current buffer"; 58 + } 59 + { 60 + mode = "n"; 61 + key = "<Leader>gB"; 62 + action = "<cmd>Gitsigns blame_line<CR>"; 63 + options.desc = "Blame current line"; 64 + } 65 + ]; 7 66 }; 8 67 }
+1 -1
modules/features/apps/nixvim/lsp/bash.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.lsp.servers.bashls = { 2 + programs.nixvim.config.plugins.lsp.servers.bashls = { 3 3 enable = true; 4 4 }; 5 5 }
+1 -1
modules/features/apps/nixvim/lsp/completion.nix
··· 1 1 _: { 2 - programs.nixvim.plugins = { 2 + programs.nixvim.config.plugins = { 3 3 cmp = { 4 4 enable = true; 5 5 autoEnableSources = true;
+3 -3
modules/features/apps/nixvim/lsp/default.nix
··· 2 2 { 3 3 imports = lib.custom.scanPaths ./.; 4 4 5 - programs.nixvim.plugins.lsp = { 5 + programs.nixvim.config.plugins.lsp = { 6 6 enable = true; 7 7 8 8 capabilities = '' ··· 68 68 diagnostic = { 69 69 "<leader>k" = "goto_prev"; 70 70 "<leader>j" = "goto_next"; 71 - "<leader>e" = "open_float"; 71 + "<leader>de" = "open_float"; 72 72 "<leader>q" = "setloclist"; 73 73 }; 74 74 lspBuf = { ··· 80 80 "K" = "hover"; 81 81 "<leader>rn" = "rename"; 82 82 "<leader>ca" = "code_action"; 83 - "<leader>f" = "format"; 83 + "<leader>lf" = "format"; 84 84 }; 85 85 }; 86 86
+1 -1
modules/features/apps/nixvim/lsp/json.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.lsp.servers.jsonls = { 2 + programs.nixvim.config.plugins.lsp.servers.jsonls = { 3 3 enable = true; 4 4 }; 5 5 }
+1 -1
modules/features/apps/nixvim/lsp/markdown.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.lsp.servers.marksman = { 2 + programs.nixvim.config.plugins.lsp.servers.marksman = { 3 3 enable = true; 4 4 }; 5 5 }
+2 -2
modules/features/apps/nixvim/lsp/nix.nix
··· 4 4 }: 5 5 { 6 6 programs.nixvim = { 7 - plugins.nix = { 7 + config.plugins.nix = { 8 8 enable = true; 9 9 }; 10 10 11 - plugins.lsp.servers.nixd = { 11 + config.plugins.lsp.servers.nixd = { 12 12 enable = true; 13 13 settings = { 14 14 nixpkgs = {
+1 -1
modules/features/apps/nixvim/lsp/python.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.lsp.servers.pyright = { 2 + programs.nixvim.config.plugins.lsp.servers.pyright = { 3 3 enable = true; 4 4 settings = { 5 5 python = {
+1 -1
modules/features/apps/nixvim/lsp/typescript.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.lsp.servers.ts_ls = { 2 + programs.nixvim.config.plugins.lsp.servers.ts_ls = { 3 3 enable = true; 4 4 }; 5 5 }
+1 -1
modules/features/apps/nixvim/lsp/yaml.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.lsp.servers.yamlls = { 2 + programs.nixvim.config.plugins.lsp.servers.yamlls = { 3 3 enable = true; 4 4 }; 5 5 }
+1 -1
modules/features/apps/nixvim/ui/bufferline.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.bufferline = { 2 + programs.nixvim.config.plugins.bufferline = { 3 3 enable = true; 4 4 }; 5 5 }
+35 -19
modules/features/apps/nixvim/ui/nvim-tree.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.nvim-tree = { 3 - enable = true; 4 - openOnSetup = true; 5 - openOnSetupFile = true; 6 - settings = { 7 - auto_reload_on_write = true; 2 + programs.nixvim.config = { 3 + plugins.nvim-tree = { 4 + enable = true; 5 + openOnSetup = false; 6 + openOnSetupFile = false; 7 + settings = { 8 + auto_reload_on_write = true; 8 9 9 - # reclaim Ctrl-K for tmux navigator 10 - on_attach = { 11 - __raw = '' 12 - function(bufnr) 13 - local function opts(desc) 14 - return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } 15 - end 10 + # reclaim Ctrl-K for tmux navigator 11 + on_attach = { 12 + __raw = '' 13 + function(bufnr) 14 + local function opts(desc) 15 + return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } 16 + end 16 17 17 - local api = require("nvim-tree.api") 18 - api.config.mappings.default_on_attach(bufnr) 19 - vim.keymap.set("n", "<C-K>", ":TmuxNavigateUp<CR>", opts("Refresh")) 20 - end 21 - ''; 18 + local api = require("nvim-tree.api") 19 + api.config.mappings.default_on_attach(bufnr) 20 + vim.keymap.set("n", "<C-K>", ":TmuxNavigateUp<CR>", opts("Refresh")) 21 + end 22 + ''; 23 + }; 22 24 }; 23 25 }; 26 + 27 + keymaps = [ 28 + { 29 + mode = "n"; 30 + key = "<Leader>t"; 31 + action = "<cmd>NvimTreeToggle<CR>"; 32 + options.desc = "Toggle file tree"; 33 + } 34 + { 35 + mode = "n"; 36 + key = "<Leader>T"; 37 + action = "<cmd>NvimTreeFindFile<CR>"; 38 + options.desc = "Reveal current file in tree"; 39 + } 40 + ]; 24 41 }; 25 - 26 42 }
+1 -1
modules/features/apps/nixvim/ui/web-devicons.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.web-devicons = { 2 + programs.nixvim.config.plugins.web-devicons = { 3 3 enable = true; 4 4 }; 5 5 }
+57
modules/features/apps/nixvim/utils/telescope.nix
··· 1 + _: { 2 + programs.nixvim.config = { 3 + plugins.telescope = { 4 + enable = true; 5 + }; 6 + 7 + keymaps = [ 8 + { 9 + mode = "n"; 10 + key = "<Leader>ff"; 11 + action = "<cmd>Telescope find_files<CR>"; 12 + options.desc = "Find project files"; 13 + } 14 + { 15 + mode = "n"; 16 + key = "<Leader>fd"; 17 + action = "<cmd>lua require('telescope.builtin').find_files({ cwd = vim.fn.expand('%:p:h') })<CR>"; 18 + options.desc = "Find files beside current file"; 19 + } 20 + { 21 + mode = "n"; 22 + key = "<Leader>fg"; 23 + action = "<cmd>Telescope live_grep<CR>"; 24 + options.desc = "Live grep"; 25 + } 26 + { 27 + mode = "n"; 28 + key = "<Leader>fb"; 29 + action = "<cmd>Telescope buffers<CR>"; 30 + options.desc = "Find buffers"; 31 + } 32 + { 33 + mode = "n"; 34 + key = "<Leader>fr"; 35 + action = "<cmd>Telescope oldfiles<CR>"; 36 + options.desc = "Recent files"; 37 + } 38 + ]; 39 + 40 + autoCmd = [ 41 + { 42 + event = "VimEnter"; 43 + callback = { 44 + __raw = '' 45 + function() 46 + if vim.fn.argc() == 0 and vim.api.nvim_buf_get_name(0) == "" and vim.bo.buftype == "" then 47 + vim.schedule(function() 48 + require("telescope.builtin").find_files() 49 + end) 50 + end 51 + end 52 + ''; 53 + }; 54 + } 55 + ]; 56 + }; 57 + }
+1 -1
modules/features/apps/nixvim/utils/tmux-navigator.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.tmux-navigator = { 2 + programs.nixvim.config.plugins.tmux-navigator = { 3 3 enable = true; 4 4 }; 5 5 }
+1 -1
modules/features/apps/nixvim/utils/todo-comments.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.todo-comments = { 2 + programs.nixvim.config.plugins.todo-comments = { 3 3 enable = true; 4 4 }; 5 5 }
+26 -2
modules/features/apps/nixvim/utils/which-key.nix
··· 1 1 _: { 2 - programs.nixvim.plugins.which-key = { 3 - enable = true; 2 + programs.nixvim.config = { 3 + plugins.which-key = { 4 + enable = true; 5 + settings.spec = [ 6 + { 7 + __unkeyed-1 = "<leader>f"; 8 + group = "file search"; 9 + } 10 + { 11 + __unkeyed-1 = "<leader>g"; 12 + group = "git operations"; 13 + } 14 + { 15 + __unkeyed-1 = "<leader>l"; 16 + group = "lsp actions"; 17 + } 18 + { 19 + __unkeyed-1 = "<leader>d"; 20 + group = "diagnostics"; 21 + } 22 + { 23 + __unkeyed-1 = "<leader>o"; 24 + group = "opencode"; 25 + } 26 + ]; 27 + }; 4 28 }; 5 29 }