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