grace/dots
dotfiles/nix configs
git clone https://git.gae.moe/grace/dots
ddf0c79
main
1-- vim.pack.update(nil, { target = 'lockfile' }) 2 3return require ( "packed" ). setup ( function ( use ) 4use 'nvim-lua/plenary.nvim' 5use { 6'nvim-telescope/telescope.nvim' , 7config =function () 8require ( 'telescope' ). setup ( { 9defaults ={ 10vimgrep_arguments ={ 11"rg" , 12"--color=never" , 13"--no-heading" , 14"--with-filename" , 15"--line-number" , 16"--column" , 17"--smart-case" , 18"--hidden" , 19"--glob=!.git/*" , 20"--glob=!node_modules/**" , 21"--glob=!build/**" , 22} , 23file_ignore_patterns ={ "node_modules" , "^build/" , "^.git/" } , 24} , 25pickers ={ 26find_files ={ 27hidden =true , 28} 29} 30} ) 31end , 32} 33 34-- https://tduyng.com/blog/neovim-highlight-syntax/ 35use { 36'nvim-treesitter/nvim-treesitter' , 37branch ='main' , 38config =function () 39local parser_path =vim . fn . expand ( "~/.local/share/nvim/site/parser" ) 40vim . opt . runtimepath : append ( parser_path ) 41 42require ( "nvim-treesitter" ). setup ( {} ) 43require ( "nvim-treesitter" ). install ( { 44"bash" , 45"blade" , 46"c" , 47"comment" , 48"css" , 49"diff" , 50"dockerfile" , 51"fish" , 52"gitcommit" , 53"gitignore" , 54"go" , 55"gomod" , 56"gosum" , 57"gowork" , 58"html" , 59"ini" , 60"javascript" , 61"jsdoc" , 62"json" , 63"lua" , 64"luadoc" , 65"luap" , 66"make" , 67"markdown" , 68"markdown_inline" , 69"nginx" , 70"nix" , 71"proto" , 72"python" , 73"query" , 74"regex" , 75"rust" , 76"scss" , 77"sql" , 78"terraform" , 79"toml" , 80"tsx" , 81"typescript" , 82"vim" , 83"vimdoc" , 84"xml" , 85"yaml" , 86"zig" , 87} ) 88 89vim . api . nvim_create_autocmd ( "PackChanged" , { 90desc ="Handle nvim-treesitter updates" , 91group =vim . api . nvim_create_augroup ( "nvim-treesitter-pack-changed-update-handler" , { clear =true } ), 92callback =function ( event ) 93if event . data . kind == "update" then 94local ok =pcall ( vim . cmd , "TSUpdate" ) 95if ok then 96vim . notify ( "TSUpdate completed successfully!" , vim . log . levels . INFO ) 97else 98vim . notify ( "TSUpdate command not available yet, skipping" , vim . log . levels . WARN ) 99end 100end 101end , 102} ) 103 104vim . wo . foldexpr ="v:lua.vim.treesitter.foldexpr()" 105vim . bo . indentexpr ="v:lua.require'nvim-treesitter'.indentexpr()" 106 107vim . api . nvim_create_autocmd ( "FileType" , { 108pattern ={ "*" } , 109callback =function () 110local filetype =vim . bo . filetype 111if filetype and filetype ~= "" then 112local success =pcall ( function () 113vim . treesitter . start () 114end ) 115if not success then 116return 117end 118end 119end , 120} ) 121end 122} 123 124use { 125src ="https://github.com/nvim-treesitter/nvim-treesitter-textobjects" , 126version ="main" , 127config =function () 128require ( "nvim-treesitter-textobjects" ). setup ( { 129select ={ 130enable =true , 131lookahead =true , 132selection_modes ={ 133[ "@parameter.outer" ] ="v" , -- charwise 134[ "@function.outer" ] ="V" , -- linewise 135[ "@class.outer" ] ="<c-v>" , -- blockwise 136} , 137include_surrounding_whitespace =false , 138} , 139move ={ 140enable =true , 141set_jumps =true , 142} , 143} ) 144 145-- SELECT keymaps 146local sel =require ( "nvim-treesitter-textobjects.select" ) 147for _ , map in ipairs ( { 148{ { "x" , "o" } , "af" , "@function.outer" } , 149{ { "x" , "o" } , "if" , "@function.inner" } , 150{ { "x" , "o" } , "ac" , "@class.outer" } , 151{ { "x" , "o" } , "ic" , "@class.inner" } , 152{ { "x" , "o" } , "aa" , "@parameter.outer" } , 153{ { "x" , "o" } , "ia" , "@parameter.inner" } , 154{ { "x" , "o" } , "ad" , "@comment.outer" } , 155{ { "x" , "o" } , "as" , "@statement.outer" } , 156} ) do 157vim . keymap . set ( map [ 1 ], map [ 2 ], function () 158sel . select_textobject ( map [ 3 ], "textobjects" ) 159end , { desc ="Select " .. map [ 3 ] } ) 160end 161 162-- MOVE keymaps 163local mv =require ( "nvim-treesitter-textobjects.move" ) 164for _ , map in ipairs ( { 165{ { "n" , "x" , "o" } , "]]" , mv . goto_next_start , "@function.outer" } , 166{ { "n" , "x" , "o" } , "[[" , mv . goto_previous_start , "@function.outer" } , 167{ { "n" , "x" , "o" } , "]f" , mv . goto_next_start , "@function.outer" } , 168{ { "n" , "x" , "o" } , "[f" , mv . goto_previous_start , "@function.outer" } , 169{ { "n" , "x" , "o" } , "]c" , mv . goto_next_start , "@class.outer" } , 170{ { "n" , "x" , "o" } , "[c" , mv . goto_previous_start , "@class.outer" } , 171{ { "n" , "x" , "o" } , "]F" , mv . goto_next_end , "@function.outer" } , 172{ { "n" , "x" , "o" } , "[F" , mv . goto_previous_end , "@function.outer" } , 173{ { "n" , "x" , "o" } , "]o" , mv . goto_next_start , { "@loop.inner" , "@loop.outer" } } , 174{ { "n" , "x" , "o" } , "[o" , mv . goto_previous_start , { "@loop.inner" , "@loop.outer" } } , 175} ) do 176local modes , lhs , fn , query =map [ 1 ], map [ 2 ], map [ 3 ], map [ 4 ] 177-- build a human-readable desc 178local qstr =( type ( query ) == "table" ) and table . concat ( query , "," ) or query 179vim . keymap . set ( modes , lhs , function () 180fn ( query , "textobjects" ) 181end , { desc ="Move to " .. qstr } ) 182end 183end 184} 185 186 187 188use 'mbbill/undotree' 189use 'nvim-tree/nvim-web-devicons' 190use 'mfussenegger/nvim-lint' 191 192-- grrr why does neovim not have this? 193use { 194"windwp/nvim-autopairs" , 195config =function () 196require ( "nvim-autopairs" ). setup {} 197end 198} 199 200use { "akinsho/toggleterm.nvim" , config =function () 201require ( "toggleterm" ). setup { 202size =30 203} 204vim . keymap . set ( { "n" , "t" , "v" } , "<leader>tt" , require ( "toggleterm" ). toggle , { desc ="Toggle terminal" } ) 205end } 206use { 'nvim-telescope/telescope.nvim' } 207if vim . g . hostname == "turing" then 208use { 209'anurag3301/nvim-platformio.lua' , 210config =function () 211require ( 'platformio' ). setup ( { 212lsp ="ccls" --default: ccls, other option: clangd 213-- If you pick clangd, it also creates compile_commands.json 214} ) 215end 216} 217end 218 219use { 220"chentoast/marks.nvim" , 221config =function () require ( 'marks' ). setup () end 222} 223 224-- use { "MunifTanjim/nui.nvim" } 225 226use { 'rafamadriz/friendly-snippets' } 227use { 228'saghen/blink.cmp' , 229version ='v1.10.1' , 230config =function () 231require ( "blink.cmp" ). setup ( { 232fuzzy ={ 233implementation ="prefer_rust_with_warning" , 234prebuilt_binaries ={ 235download =true , 236force_version ="v1.*" 237} , 238} , 239keymap ={ preset ="enter" } , 240} ) 241end 242} 243 244use { 245'f-person/git-blame.nvim' , 246config =function () 247require ( "gitblame" ). setup { 248gitblame_delay =1 249} 250end 251} 252 253 254use { 255"mfussenegger/nvim-dap" , 256 257config =function () 258local dap =require ( "dap" ) 259 260-- require('dap.ext.vscode').load_launchjs(nil, { 261-- node = { 'javascript', 'typescript' }, 262-- python = { 'python' }, 263-- go = { 'go' }, 264-- codelldb = { 'c', 'cpp', 'rust' } 265-- }) 266 267vim . keymap . set ( 'n' , '<M-u>' , function () dap . continue () end , { desc ='DAP: Continue' } ) 268vim . keymap . set ( 'n' , '<M-i>' , function () dap . step_into () end , { desc ='DAP: Step Into' } ) 269vim . keymap . set ( 'n' , '<M-o>' , function () dap . step_out () end , { desc ='DAP: Step Out' } ) 270vim . keymap . set ( 'n' , '<M-p>' , function () dap . step_over () end , { desc ='DAP: Step Over' } ) 271vim . keymap . set ( 'n' , '<M-b>' , function () dap . toggle_breakpoint () end , { desc ='DAP: Toggle Breakpoint' } ) 272vim . keymap . set ( 'n' , '<F5>' , function () dap . continue () end ) 273vim . keymap . set ( 'n' , '<F10>' , function () dap . step_over () end ) 274vim . keymap . set ( 'n' , '<F11>' , function () dap . step_into () end ) 275vim . keymap . set ( 'n' , '<F12>' , function () dap . step_out () end ) 276vim . keymap . set ( 'n' , '<Leader>b' , function () dap . toggle_breakpoint () end ) 277vim . keymap . set ( 'n' , '<Leader>dr' , function () dap . repl . open () end ) 278 279dap . adapters . codelldb ={ 280type ="executable" , 281command ="codelldb" 282} 283dap . configurations . cpp ={ 284{ 285name ="Launch file" , 286type ="codelldb" , 287request ="launch" , 288program =function () 289return vim . fn . input ( 'Path to executable: ' , vim . fn . getcwd () .. '/' , 'file' ) 290end , 291cwd ='${workspaceFolder}' , 292stopOnEntry =false , 293} , 294} 295end 296} 297 298 299use { 300'stevearc/overseer.nvim' , 301config =function () require ( 'overseer' ). setup () end 302} 303use 'theHamsta/nvim-dap-virtual-text' 304use "nvim-neotest/nvim-nio" 305use { 306"rcarriga/nvim-dap-ui" , 307config =function () 308local dap , dapui =require ( "dap" ), require ( "dapui" ) 309dapui . setup () 310dap . listeners . before . attach . dapui_config =function () 311dapui . open () 312end 313dap . listeners . before . launch . dapui_config =function () 314dapui . open () 315end 316dap . listeners . before . event_terminated . dapui_config =function () 317dapui . close () 318end 319dap . listeners . before . event_exited . dapui_config =function () 320dapui . close () 321end 322end 323} 324 325use { "geigerzaehler/tree-sitter-jinja2" } 326 327use { 328"rose-pine/neovim" , 329as ="rose-pine" , 330config =function () 331require ( "rose-pine" ). setup ( { 332variant ="moon" 333} ) 334vim . cmd ( "colorscheme rose-pine" ) 335end 336} 337 338use { 339'chomosuke/typst-preview.nvim' , 340config =function () 341require 'typst-preview' . setup {} 342end , 343} 344 345 346use ( { 347"iamcco/markdown-preview.nvim" , 348config =function () 349vim . api . nvim_create_user_command ( "MDPreviewInstall" , function () 350vim . vim . fn [ "mkdp#util#install" ]() 351end , {} ) 352end , 353} ) 354 355 356use { 357'LukasPietzschmann/telescope-tabs' , 358config =function () 359require 'telescope-tabs' . setup { 360-- Your custom config :^) 361} 362end 363} 364use "HiPhish/rainbow-delimiters.nvim" 365 366use { 367'diogo464/hotreload.nvim' , 368config =function () 369require ( 'hotreload' ). setup ( { 370interval =500 , 371} ) 372end 373} 374 375use { 376"lukas-reineke/indent-blankline.nvim" , 377config =function () 378require ( "ibl" ). setup { 379indent ={ highlight ={ "Comment" } , char ="▏" } , 380scope ={ highlight ={ "@variable" } , show_start =false , show_end =false } , 381} 382end 383} 384 385use { 386"https://tangled.org/bpavuk.neocities.org/jj-log.nvim.git" , 387config =function () 388require ( 'jj-log' ). setup { 389out_waiting ="..." , 390out_no_jj_repo ="~no_jj_repo~" , 391out_no_desc ="~no_desc~" , 392max_desc_length =47 , 393full_desc =false , 394} 395end 396} 397 398use { 399'nvim-lualine/lualine.nvim' , 400config =function () 401require ( 'lualine' ). setup { 402options ={ theme ="rose-pine" } , 403sections ={ 404lualine_a ={ 'mode' } , 405lualine_b ={ 406function () 407return vim . b . jj_desc or "~no desc~" 408end , 409'diff' , 410'diagnostics' } , 411lualine_c ={ 'filename' } , 412lualine_x ={ 'encoding' , 'fileformat' , 'filetype' } , 413lualine_y ={ 'progress' } , 414lualine_z ={ 'location' } 415} , 416} 417end 418} 419 420------------------------ 421end )