Ⅰ. 插件描述
help you make a menu only for buffers with a certain filetypeⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/bwftmenu-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/bwftmenu-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/bwftmenu-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/bwftmenu.vim
Ⅳ. 文档说明
Description:
You can use This script to help you make a menu which only appears when you are editing buffers with a certain filetype. You can use this script to make menus in your ftplugin scripts.
The menu is automatically made once you enter a buffer whose filetype is specified. And if you switch to another buffer with a different filetype, the revious menu is automatically deleted.
Usage:
In your ftplugin scripts, follow these steps:
1. write a function which creates a menu. The function should not
start with s: or <SID>.
2. call BW_RegisterFTMenu function which is the only function provided by this script
That's all.
Here is an example. I want to create a menu only for python files, so I create a function in my ftplugin/python.vim:
function MakeFTMenu_python
amenu 8000.11 Python.check :echo 'check python script'
amenu 8000.12 Python.run :echo 'run python script'
endfunction
and then, add this statement to the same .vim file:
call BW_RegisterFTMenu('python','Python','MakeFTMenu_python')
Note: the second parameter MUST be the same with the name of the menu
which you created in MakeFTMenu_python function.