Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gennaro-tedesco/nvim-commaround
nvim plugin to toggle comments on and off
https://github.com/gennaro-tedesco/nvim-commaround
lua neovim
Last synced: 3 months ago
JSON representation
nvim plugin to toggle comments on and off
- Host: GitHub
- URL: https://github.com/gennaro-tedesco/nvim-commaround
- Owner: gennaro-tedesco
- License: mit
- Created: 2021-02-01T08:38:20.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T23:16:04.000Z (about 2 years ago)
- Last Synced: 2024-07-31T20:51:41.824Z (6 months ago)
- Topics: lua, neovim
- Language: Lua
- Homepage:
- Size: 30.3 KB
- Stars: 41
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - gennaro-tedesco/nvim-commaround - Fast and light commenting plugin written in Lua. (Editing Support / Comment)
README
nvim-commaround
toggle comments on and off
Installation •
Usage •
Customisation •
Feedback`nvim-commaround` comes and goes around, comments up and down! It toggles comments for visual blocks or inline code according to the buffer filetype: it works out of the box, it is awesome!
## Installation
Install it using your favourite plugin manager; for instance if you are using vim-plug
```
Plug 'gennaro-tedesco/nvim-commaround'
```## Usage
Visually select the lines you want to act on and toggle commaround: the default mapping is
```
vmap c ToggleCommaround
```
The plugin detects the buffer filetype and inserts block or line comments according to the selection.![demo](https://user-images.githubusercontent.com/15387611/116161815-c73fa480-a6f4-11eb-940f-a9a012cd8676.gif)
## Customisation
The list of filetypes configuration characters can be found [here](https://github.com/gennaro-tedesco/nvim-commaround/blob/master/lua/nvim-commaround/config.lua). To add comment characters for a new filetype (or to modify the existing ones) specify the below in your nvim configurations (`init.vim` or any other option file being sourced at start-up), say
```
lua require('nvim-commaround.config').config["todo"] = {single = "--!", block = {left = "/*!", right = "!*/"}}
```
replacing "todo" with any specific filetype; leave `{single = "--!", block = nil}` in case no block comments are available.To change the default mapping to toggle comments define any right hand side of the option below, for example
```
let g:toggle_commaround = 'gcc'
```## Unit tests
We make use of the [busted framework](https://olivinelabs.com/busted/) for unit tests; run them with
```
busted -C lua
```## Feedback
If you find this plugin useful consider awarding it a ⭐, it is a great way to give feedback! Otherwise, any additional suggestions or merge request is warmly welcome!