This repository has no description
0

Configure Feed

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

superconfig / tools / nvim.nix
8.6 kB 294 lines
1{ inputs, ... }: 2{ 3 perSystem = 4 { system, pkgs, ... }: 5 { 6 packages.nvim = inputs.nixvim.legacyPackages.${system}.makeNixvim { 7 vimAlias = true; 8 colorschemes.ayu = { 9 enable = true; 10 settings.overrides = { 11 EoLSpace = { 12 bg = "#883333"; 13 }; 14 }; 15 }; 16 globals.mapleader = " "; 17 opts = { 18 mouse = "a"; 19 number = true; 20 shiftwidth = 2; 21 clipboard = "unnamedplus"; 22 # undo stuff 23 undofile = true; 24 undolevels = 10000; 25 undoreload = 10000; 26 listchars = "tab:⇥ ,extends:❯,precedes:❮,nbsp:␣,trail:·,eol:↲"; 27 }; 28 extraConfigVim = '' 29 set et 30 31 " show special characters 32 set list 33 34 " match trailing whitespace 35 match EoLSpace /\s\+$/ 36 37 " need to use lua to expand $HOME 38 lua vim.o.undodir = vim.fs.normalize('$HOME/.vim/undodir') 39 ''; 40 extraPackages = [ 41 pkgs.glib # for vim-lumen 42 ]; 43 extraPlugins = [ 44 pkgs.vimPlugins.vim-fetch 45 (pkgs.vimUtils.buildVimPlugin { 46 name = "vim-lumen"; 47 src = pkgs.fetchFromGitHub { 48 owner = "vimpostor"; 49 repo = "vim-lumen"; 50 rev = "ac13c32c3e309f6c6a84ff6cad8dbb135e75f0e4"; 51 hash = "sha256-rsDUDI9lh4CEX1upMBjeyBOm99GAXWGPQ9vSCN8cmFo="; 52 }; 53 }) 54 ]; 55 # not ready yet, we are waiting for none-ls to get updated 56 # extraConfigLua = '' 57 # local null_ls = require("null-ls") 58 # null_ls.register(null_ls.builtins.formatting.nix_flake_fmt) 59 # ''; 60 keymaps = [ 61 { 62 mode = "i"; 63 key = "<C-p>"; 64 action = "<Nop>"; 65 } 66 { 67 mode = "i"; 68 key = "<C-n>"; 69 action = "<Nop>"; 70 } 71 { 72 mode = "n"; 73 key = "<C-c>"; 74 action = ":q<cr>"; 75 } 76 { 77 mode = "n"; 78 key = "<Space>"; 79 action = "<Nop>"; 80 } 81 { 82 mode = "n"; 83 key = "<leader>sd"; 84 action = ":colorscheme ayu-dark<cr>"; 85 } 86 { 87 mode = "n"; 88 key = "<leader>sw"; 89 action = ":colorscheme ayu-light<cr>"; 90 } 91 { 92 mode = [ 93 "n" 94 "v" 95 ]; 96 key = "<leader>cc"; 97 action = ":CopilotChatOpen<cr>"; 98 } 99 { 100 mode = [ 101 "n" 102 "v" 103 ]; 104 key = "<leader>ce"; 105 action = ":CopilotChatExplain<cr>"; 106 } 107 { 108 mode = [ 109 "n" 110 "v" 111 ]; 112 key = "<leader>cr"; 113 action = ":CopilotChatReview<cr>"; 114 } 115 { 116 mode = [ 117 "n" 118 "v" 119 ]; 120 key = "<leader>cf"; 121 action = ":CopilotChatFix<cr>"; 122 } 123 { 124 mode = [ 125 "n" 126 "v" 127 ]; 128 key = "<leader>cd"; 129 action = ":CopilotChatDocs<cr>"; 130 } 131 { 132 mode = [ 133 "n" 134 "x" 135 ]; 136 key = "p"; 137 action = "<Plug>(YankyPutAfter)"; 138 } 139 { 140 mode = [ 141 "n" 142 "x" 143 ]; 144 key = "P"; 145 action = "<Plug>(YankyPutBefore)"; 146 } 147 { 148 mode = [ 149 "c" 150 "i" 151 "n" 152 "x" 153 ]; 154 key = "<M-CR>"; 155 action = ":lua vim.lsp.buf.code_action()<CR>"; 156 } 157 { 158 mode = [ 159 "n" 160 ]; 161 key = "gd"; 162 action = ":lua vim.lsp.buf.definition()<CR>"; 163 } 164 { 165 mode = [ 166 "n" 167 ]; 168 key = "gD"; 169 action = ":lua vim.lsp.buf.declaration()<CR>"; 170 } 171 ]; 172 # autoCmd = [ 173 # { 174 # event = "BufWritePost"; 175 # desc = "run treefmt on save"; 176 # # https://stackoverflow.com/questions/77466697/how-to-automatically-format-on-save 177 # callback.__raw = '' 178 # function() 179 # vim.cmd("silent !treefmt %") 180 # vim.cmd("edit") 181 # end 182 # ''; 183 # } 184 # ]; 185 plugins.none-ls = { 186 enable = true; 187 # sources.formatting.treefmt = { 188 # enable = true; 189 # package = pkgs.emptyDirectory; 190 # }; 191 # package = pkgs.vimPlugins.none-ls-nvim.overrideAttrs (_old: { 192 # src = pkgs.fetchFromGitHub { 193 # owner = "lassulus"; 194 # repo = "none-ls.nvim"; 195 # rev = "292c2b5eadea0a097b9a01804aea70f5c8125200"; 196 # sha256 = "sha256-nbzqXsxmYfxngdJH3NXMLmGgygh6reSEnruoc6l8t/s="; 197 # }; 198 # }); 199 }; 200 plugins.web-devicons.enable = true; 201 plugins.telescope.extensions.undo.enable = true; 202 plugins.telescope = { 203 enable = true; 204 keymaps = { 205 "<leader>b" = "buffers"; 206 "<leader>u" = "undo"; 207 "<leader>ff" = "find_files"; 208 "<leader>fg" = "live_grep"; 209 "<leader>fh" = "help_tags"; 210 "<leader>fp" = "yank_history"; 211 }; 212 }; 213 plugins.lsp-format.enable = true; 214 plugins.lsp-lines.enable = true; 215 plugins.lsp = { 216 enable = true; 217 servers = { 218 bashls.enable = true; # bash 219 nixd = { 220 enable = true; # nix 221 extraOptions.offset_encoding = "utf-8"; # workaround https://github.com/nix-community/nixvim/issues/2390#issuecomment-2408101568 222 }; 223 ruff.enable = true; # python 224 pyright.enable = true; # python 225 jsonls.enable = true; # json 226 }; 227 }; 228 plugins.treesitter.enable = true; 229 plugins.copilot-cmp.enable = true; 230 plugins.copilot-lua.panel.enabled = false; 231 plugins.copilot-lua.suggestion.enabled = false; 232 plugins.cmp_yanky.enable = true; 233 plugins.cmp = { 234 enable = true; 235 autoEnableSources = true; 236 settings = { 237 experimental = { 238 ghost_text = true; 239 }; 240 sources = [ 241 { name = "nvim_lsp"; } 242 { name = "emoji"; } 243 { 244 name = "buffer"; # text within current buffer 245 option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; 246 keywordLength = 2; 247 } 248 { 249 name = "copilot"; # enable copilot 250 } 251 { 252 name = "path"; # file system paths 253 keywordLength = 3; 254 } 255 { name = "cmp_yanky"; } 256 ]; 257 258 mapping = { 259 "<Tab>" = "cmp.mapping.select_next_item()"; 260 "<S-Tab>" = "cmp.mapping.select_prev_item()"; 261 "<C-n>" = "cmp.mapping.select_next_item()"; 262 "<C-p>" = "cmp.mapping.select_prev_item()"; 263 "<C-e>" = "cmp.mapping.abort()"; 264 "<C-b>" = "cmp.mapping.scroll_docs(-4)"; 265 "<C-f>" = "cmp.mapping.scroll_docs(4)"; 266 "<CR>" = '' 267 cmp.mapping({ 268 i = function(fallback) 269 if cmp.visible() and cmp.get_active_entry() then 270 cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) 271 else 272 fallback() 273 end 274 end, 275 s = cmp.mapping.confirm({ select = true }), 276 c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), 277 }) 278 ''; 279 }; 280 }; 281 }; 282 plugins.bufferline.enable = true; 283 plugins.which-key.enable = true; 284 plugins.yanky = { 285 enable = true; 286 enableTelescope = true; 287 }; 288 plugins.comment.enable = true; 289 plugins.copilot-chat.enable = true; 290 plugins.undotree.enable = true; # seems to be needed for undo history in telescope 291 plugins.leap.enable = true; 292 }; 293 }; 294}