MyGit

folke/ts-comments.nvim

Fork: 23 Star: 345 (更新于 2024-11-05 09:31:28)

license: Apache-2.0

Language: Lua .

Tiny plugin to enhance Neovim's native comments

最后发布版本: v1.5.0 ( 2024-07-24 13:45:03)

GitHub网址

🚀 ts-comments.nvim

Tiny plugin to enhance Neovim's native comments:

  • Easily override the comment string for a given treesitter language
  • Supports different comment strings for different treesitter node types
  • Relaxed rules for uncommenting
  • Add proper whitespace when needed
  • Supports multiple commentstrings for the same language. The first one is used for adding comments. All are used for uncommenting.

⚡️ Requirements

  • Neovim >= 0.10.0

📦 Installation

Using lazy.nvim:

{
  "folke/ts-comments.nvim",
  opts = {},
  event = "VeryLazy",
  enabled = vim.fn.has("nvim-0.10.0") == 1,
}

⚙️ Configuration

ts-comments.nvim uses the default Neovim commentstring as a fallback, so there's no need to configure every language.

Default configuration:

{
  lang = {
    astro = "<!-- %s -->",
    axaml = "<!-- %s -->",
    blueprint = "// %s",
    c = "// %s",
    c_sharp = "// %s",
    clojure = { ";; %s", "; %s" },
    cpp = "// %s",
    cs_project = "<!-- %s -->",
    cue = "// %s",
    fsharp = "// %s",
    fsharp_project = "<!-- %s -->",
    gleam = "// %s",
    glimmer = "{{! %s }}",
    graphql = "# %s",
    handlebars = "{{! %s }}",
    hcl = "# %s",
    html = "<!-- %s -->",
    hyprlang = "# %s",
    ini = "; %s",
    ipynb = "# %s",
    javascript = {
      "// %s", -- default commentstring when no treesitter node matches
      "/* %s */",
      call_expression = "// %s", -- specific commentstring for call_expression
      jsx_attribute = "// %s",
      jsx_element = "{/* %s */}",
      jsx_fragment = "{/* %s */}",
      spread_element = "// %s",
      statement_block = "// %s",
    },
    kdl = "// %s",
    php = "// %s",
    rego = "# %s",
    rescript = "// %s",
    rust = { "// %s", "/* %s */" },
    sql = "-- %s",
    styled = "/* %s */",
    svelte = "<!-- %s -->",
    templ = {
      "// %s",
      component_block = "<!-- %s -->",
    },
    terraform = "# %s",
    tsx = {
      "// %s", -- default commentstring when no treesitter node matches
      "/* %s */",
      call_expression = "// %s", -- specific commentstring for call_expression
      jsx_attribute = "// %s",
      jsx_element = "{/* %s */}",
      jsx_fragment = "{/* %s */}",
      spread_element = "// %s",
      statement_block = "// %s",
    },
    twig = "{# %s #}",
    typescript = { "// %s", "/* %s */" }, -- langs can have multiple commentstrings
    vue = "<!-- %s -->",
    xaml = "<!-- %s -->",
  },
}

🔗 Related

最近版本更新:(数据更新于 2024-10-16 15:01:35)

2024-07-24 13:45:03 v1.5.0

2024-07-15 17:22:11 v1.4.0

2024-07-05 22:07:24 v1.3.0

2024-05-26 17:52:35 v1.2.0

2024-05-22 01:37:28 v1.1.0

2024-05-21 05:41:53 v1.0.1

2024-05-21 05:32:57 v1.0.0

主题(topics):

neovim, neovim-plugin, nvim, nvim-plugin

folke/ts-comments.nvim同语言 Lua最近更新仓库

2024-11-21 03:52:06 koreader/koreader

2024-11-20 23:41:49 xiaorouji/openwrt-passwall

2024-11-20 16:46:43 xiaorouji/openwrt-passwall2

2024-11-19 22:36:38 LazyVim/LazyVim

2024-11-18 05:33:22 olimorris/codecompanion.nvim

2024-11-10 02:39:54 kenzok8/small