Giter VIP home page Giter VIP logo

omap.vim's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1246

Omap.vim provides the :Omap command, among others, which creates user-defined operator commands (like y c d and g?, see :help operator for more info).

To demonstrate, this command can be used to add functionality to other scripts. You can use Omap.vim in conjuction with EnhancedCommentify.vim (vimscript #23) to create a commenting operator. Assuming both EnhancedCommentify.vim and Omap.vim are installed in your vim plugin directory, add the following commands to your .vimrc file:

    let g:EnhCommentifyUserBindings = 'yes'
    runtime plugin/Omap.vim
    Omap <silent> <unique> <leader>c <Plug>Commentj
    Omap <silent> <unique> <leader>u <Plug>DeCommentj

This will stop the default mappings being defined by EnhancedCommentify.vim and in their place create comment (\c) and uncomment (\u) operators.

This allows commenting to be carried out over areas defined by vim motions and text objects. For example: 

    \cc  --  comments a line
    .  --  comments the next line (repeats last command)
    3\cc  --  comments three lines
    \uu  --  uncomments a line
    \c4j  --  comments the current line and the four following lines
    \caB  --  comments a block of code

Note that the dot (.) command (see :help .) works to repeat Omaps even though they are mappings. A command, :DotCommandSet, is defined by Omap.vim which allows other mappings to similarly be repeated using the dot command. 

For more detailed help see the help documentation in the archive below.

omap.vim's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

bencollerson

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.