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