forked from vim-scripts/Omap.vim
create user-defined operator mappings
License
bencollerson/Omap.vim
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
About
create user-defined operator mappings
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Vim Script 100.0%