nvim/.config/nvim/lua/plugins/editor/comment.lua

-- nvim/.config/nvim/lua/plugins/editor/comment.lua
-- Plain Comment.nvim with JSX/TSX context commentstring.

return {
  "numToStr/Comment.nvim",
  dependencies = {
    "JoosepAlviste/nvim-ts-context-commentstring",
  },
  keys = {
    { "gcc", mode = "n", desc = "toggle line comment" },
    { "gbc", mode = "n", desc = "toggle block comment" },
    { "gc",  mode = { "n", "v", "o" }, desc = "comment" },
    { "gb",  mode = { "n", "v", "o" }, desc = "block comment" },
  },
  opts = function()
    require("ts_context_commentstring").setup({ enable_autocmd = false })
    return {
      padding = true,
      sticky  = true,
      pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
    }
  end,
}