Ⅰ. 插件描述
Create repeat.vim mappings with one simple "Repeatable" commandⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'kreskij/repeatable-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'kreskij/repeatable-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'kreskij/repeatable-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/kreskij/repeatable.vim
Ⅳ. 文档说明
# Repeatable.vim
Repeatable.vim provides a simple interface to create dot(.) repeatable mappings via tpope's
repeat.vim. AddRepeatable in front of your mapping and it will be
- This works with the various mapping arguments such as
<silent>,<expr>,<buffer>, etc. It is designed to work exactly
as you'd expect with a typical mapping, except repeatable.
Example with Repeatable.vim
Repeatable nnoremap gp p`]Example without Repeatable.vim
nnoremap <silent> <Plug>PasteBelowCursorEnd p`]
\:call repeat#set("\<Plug>PasteBelowCursorEnd")<CR>
nmap gp <Plug>PasteBelowCursorEndMany users install repeat.vim as a supplement to other plugins
however some may shy away from creating their own mappings due to its interface
being verbose or intimidating. This plugin reduces it down to one Repeatable
command which you add as a prefix to your mapping. No need to mess with
custom <Plug> mappings, Repeatable.vim will take care of that for you.
Install with on-demand loading
Add the Repeatable command to on-demand loading if your plugin manager supports it.
" Example using vim-plug and on-demand loading
Plug 'tpope/vim-repeat'
Plug 'kreskij/Repeatable.vim', { 'on': 'Repeatable' }Install without on-demand loading
If your plugin manager doesn't support on-demand loading, call
the repeatable#Setup() function before any use of the Repeatable command
" Example using vim-plug and without on-demand loading
Plug 'tpope/vim-repeat'
Plug 'kreskij/Repeatable.vim'
"...
call repeatable#Setup()Usage
Define mappings as you normally would and add Repeatable in front.
This plugin works with <expr> mappings too.
Examples
" Paste below/above and put cursor at the end of the paste
Repeatable nnoremap gp p`]
Repeatable nnoremap gP P`]
" Paste inside current line (overwrites line) (repeatable)
Repeatable nnoremap <expr> gpp '"_dd"'.v:register.'P'