Code Monkey home page Code Monkey logo

vim-textobj-comment's Introduction

textobj-comment

This Vim plugin provides text objects for comments.

ag selects a comment including the comment delimiters and ig selects just the comment content. (There's also a third text object, aG, which selects a comment including trailing or leading whitespace.) These mappings are available in Visual and Operator-pending mode.

This plugin uses the 'comments' and 'commentstring' settings to determine what a comment looks like for a given filetype. It works with both /* paired */ and // simple comment delimiters.

This plugin depends on the textobj-user plugin.

Usage

Comprehensive on-line documentation is included and available at :h textobj-comment.

Below is a quick demo of the 'a comment' text object. The command used is vag. The targeted area is the same for analogous commands using an operator, such as dag, cag, and gqag.

demo

The 'inner comment' text object targets the inside of a comment. Here I use cig:

demo

Requirements

  • Vim 7.3 or later
  • textobj-user Vim plugin, at least version 0.4.0

Installation

Move the files into their respective directories inside your ~/.vim directory (or your $HOME\vimfiles directory if you're on Windows).

With pathogen.vim the installation is as simple as:

git clone git://github.com/glts/vim-textobj-comment.git ~/.vim/bundle/textobj-comment

This plugin also plays well with other plugin managers.

Don't forget to install textobj-user, too, if your setup doesn't take care of dependencies automatically.

Development

The code isn't pretty. If you look closely you'll notice a lot of effort being made to cover corner cases and make the behaviour of the text objects as similar to the built-ins as possible. That said, if you are interested in working on it, use the test suite to make sure you don't break anything.

The test suite is written using vspec.

make test runs the whole suite and make t/<test>.vim runs a specific test. You may need to adapt the paths to the vspec executable and to the runtime path directories at the top of the Makefile.

vim-textobj-comment's People

Contributors

glts avatar webdavis avatar

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.