]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nvim/lua/plugins/comment.lua
neovim: configure, using ghostty and tmux
[julm/julm-nix.git] / home-manager / profiles / nvim / lua / plugins / comment.lua
1 -- Smart and powerful comment plugin for neovim.
2 -- Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more
3 -- https://github.com/numToStr/Comment.nvim
4 return {
5 "comment.nvim",
6 event = { "BufEnter" },
7 after = function()
8 require("Comment").setup({
9 ---Add a space b/w comment and the line
10 padding = true,
11 ---Whether the cursor should stay at its position
12 sticky = true,
13 ---Lines to be ignored while (un)comment
14 ignore = nil,
15 ---LHS of toggle mappings in NORMAL mode
16 toggler = {
17 ---Line-comment toggle keymap
18 line = "gcc",
19 ---Block-comment toggle keymap
20 block = "gbc",
21 },
22 ---LHS of operator-pending mappings in NORMAL and VISUAL mode
23 opleader = {
24 ---Line-comment keymap
25 line = "gc",
26 ---Block-comment keymap
27 block = "gb",
28 },
29 ---LHS of extra mappings
30 extra = {
31 ---Add comment on the line above
32 above = "gcO",
33 ---Add comment on the line below
34 below = "gco",
35 ---Add comment at the end of line
36 eol = "gcA",
37 },
38 ---Enable keybindings
39 ---NOTE: If given `false` then the plugin won't create any mappings
40 mappings = {
41 ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
42 basic = true,
43 ---Extra mapping; `gco`, `gcO`, `gcA`
44 extra = true,
45 },
46 ---Function to call before (un)comment
47 pre_hook = nil,
48 ---Function to call after (un)comment
49 post_hook = nil,
50 })
51 end,
52 }