Code Monkey home page Code Monkey logo

nvim-commaround's Introduction

nvim-commaround

PR Lua

toggle comments on and off

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 <leader>c <Plug>ToggleCommaround

The plugin detects the buffer filetype and inserts block or line comments according to the selection.

demo

Customisation

The list of filetypes configuration characters can be found here. 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 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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.