Ⅰ. 插件描述
let you create tree menu in vim buffer very easily.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'c9s/treemenu-vim-better-than-revenge'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'c9s/treemenu-vim-better-than-revenge'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'c9s/treemenu-vim-better-than-revenge'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/c9s/treemenu.vim
Ⅳ. 文档说明
TreeMenu Class
let you create tree menu in vim buffer very easily.
Example
You should write your tree menu plugin in ~/.vim/after/plugin/blah.vim :
fun! Func1(...)
echo a:0
endf
new
unlet m
let m = g:MenuBuffer.create({ 'buf_nr': bufnr('.') })
cal m.addPath( 'Tree.Node1', { 'exe': 'echo' , 'args': [ '"YES"' ] , 'close': 0 })
cal m.addPath( 'Tree.Node2.zxcv', { 'exe': 'echo' , 'args': [ '"YES"' ] , 'close': 0 })
cal m.addPath( 'Tree.Node2.zxcv', { 'exe': function('Func1') , 'args': [ '"YES"' ] , 'close': 0 })
cal m.addPath( 'Tree.Ah Space.A2', { 'exe': 'echo' , 'inputs': [ ['Test:','123'] ] , 'close': 0 })
cal m.render()
item options:
label: (string)
item label
exe: (string|function)
command or function to execute.
args (list)
arguments for exe
close: (boolean)
close buffer after executing command.
if you try a tab in command, you should set this to 0.
refresh: (boolean)
drop menu buffer after executing command.
inputs: (list[ list ])
take arguemnts from input
inputs option:
'inputs':[ [
{Label: String} ,
{Default Value: String|Integer|Function ref} ,
{Command Completion: String (optional) },
{Skip When Empty: Bool (optional) },
],[ .. ], [ .. ] ]