https://github.com/soemre/commentless.nvim
Hide comments, focus on the code flow, and reveal them if needed π§
https://github.com/soemre/commentless.nvim
comments lua neovim neovim-plugin
Last synced: 7 days ago
JSON representation
Hide comments, focus on the code flow, and reveal them if needed π§
- Host: GitHub
- URL: https://github.com/soemre/commentless.nvim
- Owner: soemre
- License: mit
- Created: 2025-04-12T18:43:56.000Z (26 days ago)
- Default Branch: main
- Last Pushed: 2025-04-26T10:14:29.000Z (12 days ago)
- Last Synced: 2025-05-01T08:16:46.774Z (7 days ago)
- Topics: comments, lua, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 19.5 KB
- Stars: 24
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - soemre/commentless.nvim (β14) - Fold all comments to better visualize your code logic, and unfold them whenever needed. (Recently Updated / [Apr 28, 2025](/content/2025/04/28/README.md))
- awesome-neovim-sorted - soemre/commentless.nvim
README
# π§ commentless.nvim
Hide comments, focus on the code flow, and reveal them if needed.
This plugin lets you fold all comments to better visualize your codeβs logic,
and unfold them whenever needed.
![]()
## π¦ Installation
Use your favorite plugin manager to install it, and then run
`require("soemre/commentless.nvim").setup({})` to start it up.Also, check out the [Some Recommendations for Global Folding Behavior](some-recommendations-for-global-folding-behavior) section.
### lazy.nvim
The `setup` call is handled internally by `lazy.nvim`.
```lua
{
"soemre/commentless.nvim",
cmd = "Commentless",
keys = {
{
"/",
function()
require("commentless").toggle()
end,
desc = "Toggle Comments",
},
},
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
opts = {
-- Customize Configuration
},
}
```## π Usage
To get started, bind keys to the public API or run `:Commentless ` directly.
### Example
```lua
vim.keymap.set("n", "/", function()
require("commentless").toggle()
end)
```## π οΈ Configuration
Check `:help commentless` for full documentation.
### Default Configuration
```lua
{
hide_following_blank_lines = true,
foldtext = function(folded_count)
return "(" .. folded_count .. " comments)"
end,
}
```### Some Recommendations for Global Folding Behavior
```lua
vim.opt.foldminlines = 0 -- Allow folding/hiding single lines
vim.opt.fillchars = "fold: " -- Remove the trailing dots
```## β FAQ
### Why isn't it working with some file types?
To determine whether something is a comment, it uses `tree-sitter`. Therefore,
you need to have `tree-sitter` parsers installed for the file types (languages)
you plan to use. You can install them using `:TSInstall `
or via the `ensure_installed` option in `tree-sitter`'s setup parameters.