An open API service indexing awesome lists of open source software.

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 🧘

Awesome Lists containing this project

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.


commentless.nvim usage

## πŸ“¦ 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.