default.nix 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. { inputs
  2. , pkgs
  3. , ...
  4. }:
  5. {
  6. imports = [
  7. inputs.nixvim.homeManagerModules.nixvim
  8. ./copilot.nix # copilot plugin
  9. ./lsp.nix
  10. ./mini.nix # mini.nvim plugin
  11. ./opencode.nix
  12. ./telescope.nix # fuzzy find everything
  13. ./treesitter.nix # treesitter support
  14. ./which-key.nix # keybinding helper
  15. ];
  16. home.packages = [ pkgs.zig ];
  17. programs.nixvim.plugins = {
  18. tmux-navigator.enable = true;
  19. todo-comments.enable = true; # todo comments eg TODO, FIXME, etc
  20. };
  21. programs.nixvim = {
  22. enable = true;
  23. defaultEditor = true;
  24. vimdiffAlias = true;
  25. extraPlugins = with pkgs; [
  26. vimPlugins.kanagawa-nvim
  27. ];
  28. extraConfigLua = ''
  29. require("kanagawa").setup({
  30. transparent = true,
  31. })
  32. vim.cmd.colorscheme("kanagawa")
  33. '';
  34. globals.mapleader = " ";
  35. globals.maplocalleader = " ";
  36. globals.have_nerd_font = true;
  37. clipboard.register = "unnamedplus";
  38. opts = {
  39. number = true;
  40. relativenumber = true;
  41. showmode = false;
  42. breakindent = true;
  43. undofile = true;
  44. ignorecase = true;
  45. smartcase = true;
  46. signcolumn = "yes";
  47. updatetime = 250;
  48. timeoutlen = 300;
  49. splitright = true;
  50. splitbelow = true;
  51. list = true;
  52. listchars = {
  53. tab = "» ";
  54. trail = "·";
  55. nbsp = "␣";
  56. };
  57. inccommand = "split";
  58. cursorline = true;
  59. scrolloff = 10;
  60. hlsearch = true;
  61. swapfile = false;
  62. backup = false;
  63. conceallevel = 1;
  64. laststatus = 3;
  65. cmdheight = 0;
  66. };
  67. autoCmd = [
  68. {
  69. event = "TextYankPost";
  70. desc = "Highlight when yanking (copying) text";
  71. group = "kickstart-highlight-yank";
  72. callback.__raw = ''
  73. function()
  74. vim.highlight.on_yank()
  75. end
  76. '';
  77. }
  78. ];
  79. autoGroups = {
  80. "kickstart-highlight-yank".clear = true;
  81. };
  82. keymaps = [
  83. {
  84. key = "<Esc>";
  85. action = "<cmd>nohlsearch<CR>";
  86. mode = "n";
  87. }
  88. # Diagnostic keymaps
  89. # { key = "<leader>q"; action.__raw = "vim.diagnostic.setloclist"; mode = "n"; options.desc = "Open diagnostic [Q]uickfix list"; }
  90. # Exit terminal mode in the builtin terminal
  91. # { key = "<Esc><Esc>"; action = "<C-\\><C-n>"; mode = "t"; option.desc = "Exit terminal mode"; }
  92. # Keybinds to make split navigation easier. TODO: figure out if these work
  93. {
  94. key = "<C-h>";
  95. action = "<C-w>h";
  96. mode = "n";
  97. options.desc = "Move focus to the left window";
  98. }
  99. {
  100. key = "<C-l>";
  101. action = "<C-w>l";
  102. mode = "n";
  103. options.desc = "Move focus to the right window";
  104. }
  105. {
  106. key = "<C-j>";
  107. action = "<C-w>j";
  108. mode = "n";
  109. options.desc = "Move focus to the lower window";
  110. }
  111. {
  112. key = "<C-k>";
  113. action = "<C-w>k";
  114. mode = "n";
  115. options.desc = "Move focus to the upper window";
  116. }
  117. # Move highlighed blocks of code up and down
  118. {
  119. key = "K";
  120. action = ":m '<-2<CR>gv=gv";
  121. mode = "v";
  122. options.desc = "Move highlighted block up";
  123. }
  124. {
  125. key = "J";
  126. action = ":m '>+1<CR>gv=gv";
  127. mode = "v";
  128. options.desc = "Move highlighted block down";
  129. }
  130. {
  131. key = "J";
  132. action = "mzJ`z";
  133. mode = "n";
  134. options.desc = "Join lines without losing cursor position";
  135. }
  136. {
  137. key = "<C-d>";
  138. action = "<C-d>zz";
  139. mode = "n";
  140. options.desc = "Scroll down and center cursor";
  141. }
  142. {
  143. key = "<C-u>";
  144. action = "<C-u>zz";
  145. mode = "n";
  146. options.desc = "Scroll up and center cursor";
  147. }
  148. {
  149. key = "n";
  150. action = "nzzzv";
  151. mode = "n";
  152. options.desc = "Find next and center cursor";
  153. }
  154. {
  155. key = "N";
  156. action = "Nzzzv";
  157. mode = "n";
  158. options.desc = "Find previous and center cursor";
  159. }
  160. ];
  161. };
  162. }