Ⅰ. 插件描述
Show the name of the code-block (e.g. function) the cursor is in on the cmd lineⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/showblockname-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/showblockname-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/showblockname-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ShowBlockName.vim
Ⅳ. 文档说明
Display the name of the current "block" the cursor is in in the command-line
area (i.e., with vim's echo).
A "block" is context-sensitive, (e.g., function name, variable name if in an
initialization, type name if in a typedef, etc.)
NOTE: The only languages with specific support as-is are vim scripts, Perl, and C. Support for other languages can be added by modifying the script with appropriate search patterns.
Typical use (.vimrc):
au CursorHold * call ShowBlockName('quiet')
" Show the name of the function we're in on the message line; pnuemonic [[
map <silent> g[[ :call ShowBlockName()<CR>
" Disable ShowBlockName (once); to prevent the CursorHold autocommand from
" overwriting something in the command window (e.g., SyntaxAttr() output).
map <silent> g]] :call ShowBlockName('OFF')<CR>
" Tweak commands like [d so that they disable ShowBlockName so
" it doesn't obliterate the output of this command.
nnoremap [d :call ShowBlockName('[d')<CR>
nnoremap [i :call ShowBlockName('[i')<CR>
NOTE:
This will NOT work if the start-of-block is the first line in a file.
THIS SCRIPT USES ShowLine ( vimscript #381 )