Ⅰ. 插件描述
Some utilities used by several of my scripts (window positioning, mark handling)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/cecutil'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/cecutil'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/cecutil'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/cecutil
Ⅳ. 文档说明
[CECUTIL V15 OR LATER REQUIRES VIMBALL V18 OR LATER FOR UNPACKING]
These routines are used by several of my utilities. I'm loading them onto vim.sf.net to make it easier for GetLatestVimScripts to automate updates with them.
Marks:
call SaveMark(markname) let savemark= SaveMark(markname)
call RestoreMark(markname) call RestoreMark(savemark)
call DestroyMark(markname)
commands: SM RM DM
Window Position:
call SaveWinPosn() let winposn= SaveWinPosn()
call RestoreWinPosn() call RestoreWinPosn(winposn)
swp : save current window/buffer's position
rwp : restore current window/buffer's previous position
commands: SWP RWP
User Maps:
call SaveUserMaps(mapmode,maplead,mapchx,suffix)
This function sets up a script-variable (ie. a variable that can generally be accessed only from within cecutil's own functions; see |s:|) called s:restoremap. The selected user's maps are appended to this variable; the RestoreUserMaps() (|cecutil-restoreusermaps|) function uses the contents of this variable to restore user maps.
Some examples follow:
call SaveUserMaps("n","","webWEBjklh$0%;,nN","HiMtchBrkt")
normal mode maps for w, e, b, W, E, B, j, k, l, etc
(if any) are all saved in the variable
s:restoremaps_HiMtchBrkt >
call SaveUserMaps("n","","<up>","DrawIt")
the normal mode map (if any) for the <up> key is saved in
the variable s:restoremaps_DrawIt >
call SaveUserMaps("n","",":F(","HiMtchBrkt")
the normal mode map for F( (if any) is saved in the
variable s:restoremaps_HiMtchBrkt
call RestoreUserMaps(suffix)
The usermaps saved by SaveUserMaps() with the given suffix will be restored (ie. s:restoremaps_{suffix}). Example:
call RestoreUserMaps("HiMtchBrkt")
will restore all user maps redefined for the HiMtchBrkt plugin
(alpha/beta version available at http://www.drchip.org/astronaut/vim/index.html#CECUTIL)