Ⅰ. 插件描述
Facilitate definition of triggers on CursorMoved[I] eventsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tomtom/hookcursormoved'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tomtom/hookcursormoved'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tomtom/hookcursormoved'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tomtom/hookcursormoved_vim
Ⅳ. 文档说明
This experimental plugin provides some help with the definition of
functions that should be called when the cursor position changed.
When the cursor position changes, it first checks if a certain condition
is met and then calls functions registered in
b:hookcursormoved_{MODE}_{CONDITION} (an array).
In order to define new conditions, you have to set the variable
"g:hookcursormoved_{CONDITION}" to a function name (STRING). This
function takes the current mode (i .. insert mode; n ... normal mode)
as single argument.
Functions are best registered using |hookcursormoved#Register()|.
Example: >
function! WhatsGoingOn(mode) "{{{3
if mode == 'i'
DoThis
elseif mode == 'n'
DoThat
endif
endf
call hookcursormoved#Register('syntaxchange', function('WhatsGoingOn'))
Status: Works for me (there may be some minor quirks)
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.