This repository has no description
0

Configure Feed

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

superconfig / tools / nvim.nix
7.3 kB 257 lines
1{ inputs, ... }: 2{ 3 perSystem = 4 { system, ... }: 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 = { }; 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 extraConfigLua = '' 41 local null_ls = require("null-ls") 42 local helpers = require("null-ls.helpers") 43 44 local treefmt_nix = { 45 method = null_ls.methods.FORMATTING, 46 filetypes = {}, 47 generator = helpers.formatter_factory({ 48 command = "treefmt", 49 args = { "--allow-missing-formatter", "--stdin", "$FILENAME" }, 50 to_stdin = true, 51 }), 52 } 53 54 null_ls.register(treefmt_nix) 55 ''; 56 keymaps = [ 57 { 58 mode = "i"; 59 key = "<C-p>"; 60 action = "<Nop>"; 61 } 62 { 63 mode = "i"; 64 key = "<C-n>"; 65 action = "<Nop>"; 66 } 67 { 68 mode = "n"; 69 key = "<C-c>"; 70 action = ":q<cr>"; 71 } 72 { 73 mode = "n"; 74 key = "<Space>"; 75 action = "<Nop>"; 76 } 77 { 78 mode = "n"; 79 key = "<leader>u"; 80 action = ":UndotreeToggle<cr>"; 81 } 82 { 83 mode = "n"; 84 key = "<leader>sd"; 85 action = ":colorscheme ayu-dark<cr>"; 86 } 87 { 88 mode = "n"; 89 key = "<leader>sw"; 90 action = ":colorscheme ayu-light<cr>"; 91 } 92 { 93 mode = [ 94 "n" 95 "v" 96 ]; 97 key = "<leader>cc"; 98 action = ":CopilotChatOpen<cr>"; 99 } 100 { 101 mode = [ 102 "n" 103 "v" 104 ]; 105 key = "<leader>ce"; 106 action = ":CopilotChatExplain<cr>"; 107 } 108 { 109 mode = [ 110 "n" 111 "v" 112 ]; 113 key = "<leader>cr"; 114 action = ":CopilotChatReview<cr>"; 115 } 116 { 117 mode = [ 118 "n" 119 "v" 120 ]; 121 key = "<leader>cf"; 122 action = ":CopilotChatFix<cr>"; 123 } 124 { 125 mode = [ 126 "n" 127 "v" 128 ]; 129 key = "<leader>cd"; 130 action = ":CopilotChatDocs<cr>"; 131 } 132 { 133 mode = [ 134 "n" 135 "x" 136 ]; 137 key = "p"; 138 action = "<Plug>(YankyPutAfter)"; 139 } 140 { 141 mode = [ 142 "n" 143 "x" 144 ]; 145 key = "P"; 146 action = "<Plug>(YankyPutBefore)"; 147 } 148 ]; 149 # autoCmd = [ 150 # { 151 # event = "BufWritePost"; 152 # desc = "run treefmt on save"; 153 # # https://stackoverflow.com/questions/77466697/how-to-automatically-format-on-save 154 # callback.__raw = '' 155 # function() 156 # vim.cmd("silent !treefmt %") 157 # vim.cmd("edit") 158 # end 159 # ''; 160 # } 161 # ]; 162 plugins.none-ls = { 163 enable = true; 164 # sources.formatting.treefmt = { 165 # enable = true; 166 # package = pkgs.emptyDirectory; 167 # }; 168 # package = pkgs.vimPlugins.none-ls-nvim.overrideAttrs (_old: { 169 # src = pkgs.fetchFromGitHub { 170 # owner = "lassulus"; 171 # repo = "none-ls.nvim"; 172 # rev = "292c2b5eadea0a097b9a01804aea70f5c8125200"; 173 # sha256 = "sha256-nbzqXsxmYfxngdJH3NXMLmGgygh6reSEnruoc6l8t/s="; 174 # }; 175 # }); 176 }; 177 plugins.web-devicons.enable = true; 178 plugins.telescope = { 179 enable = true; 180 keymaps = { 181 "<leader>b" = "buffers"; 182 "<leader>ff" = "find_files"; 183 "<leader>fg" = "live_grep"; 184 "<leader>fh" = "help_tags"; 185 "<leader>fp" = "yank_history"; 186 }; 187 }; 188 plugins.lsp-format.enable = true; 189 plugins.lsp = { 190 enable = true; 191 servers = { 192 bashls.enable = true; # bash 193 nixd.enable = true; # nix 194 ruff-lsp.enable = true; # python 195 harper-ls.enable = true; # comments 196 jsonls.enable = true; # json 197 }; 198 }; 199 plugins.undotree = { 200 enable = true; 201 settings.SetFocusWhenToggle = true; 202 }; 203 plugins.treesitter.enable = true; 204 plugins.copilot-cmp.enable = true; 205 plugins.copilot-lua.panel.enabled = false; 206 plugins.copilot-lua.suggestion.enabled = false; 207 plugins.cmp_yanky.enable = true; 208 plugins.cmp = { 209 enable = true; 210 autoEnableSources = true; 211 settings = { 212 experimental = { 213 ghost_text = true; 214 }; 215 sources = [ 216 { name = "nvim_lsp"; } 217 { name = "emoji"; } 218 { 219 name = "buffer"; # text within current buffer 220 option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; 221 keywordLength = 2; 222 } 223 { 224 name = "copilot"; # enable copilot 225 } 226 { 227 name = "path"; # file system paths 228 keywordLength = 3; 229 } 230 { name = "cmp_yanky"; } 231 ]; 232 233 mapping = { 234 "<Tab>" = "cmp.mapping.select_next_item()"; 235 "<S-Tab>" = "cmp.mapping.select_prev_item()"; 236 "<C-n>" = "cmp.mapping.select_next_item()"; 237 "<C-p>" = "cmp.mapping.select_prev_item()"; 238 "<C-e>" = "cmp.mapping.abort()"; 239 "<C-b>" = "cmp.mapping.scroll_docs(-4)"; 240 "<C-f>" = "cmp.mapping.scroll_docs(4)"; 241 "<C-Space>" = "cmp.mapping.complete()"; 242 "<CR>" = "cmp.mapping.confirm({ select = true })"; 243 "<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; 244 }; 245 }; 246 }; 247 plugins.bufferline.enable = true; 248 plugins.which-key.enable = true; 249 plugins.yanky = { 250 enable = true; 251 enableTelescope = true; 252 }; 253 plugins.comment.enable = true; 254 plugins.copilot-chat.enable = true; 255 }; 256 }; 257}