comment.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. return {
  2. -- add this to your lua/plugins.lua, lua/plugins/init.lua, or the file you keep your other plugins:
  3. 'numToStr/Comment.nvim',
  4. opts = {
  5. -- add any options here
  6. },
  7. config = 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. }