grace/dots

dotfiles/nix configs

git clone https://git.gae.moe/grace/dots

Grace Yoderhx and vcs changesddf0c79

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