Ⅰ. 插件描述
Create your own custom view of the file based on regexⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/outline'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/outline'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/outline'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/outline
Ⅳ. 文档说明
Vim has many possibilites to let you find the code you want to have a look at.
This script shows all matches of a regular expression in another buffer together with line numbers. The cursor will be placed where you have been.
So you won't loose orientation.
I think a small example will help you much to illustrate what this script can do for you
The script is called autoload/vl/ui/navigation/jump_to_code_by_regex.vim
and looks like :
[...]
function! vl#ui#navigation#jump_to_code_by_regex#Outline(regex, ...)
exec vl#lib#brief#args#GetOptionalArg('try_higlight', string(0))
[...]
endfunction
[...]
function ...
After using the mapping you'll get
17 function! vl#ui#navigation#jump_to_code_by_regex#Outline(regex, ...)
66 function! vl#ui#navigation#jump_to_code_by_regex#JumpToPos()
75 function! vl#ui#navigation#jump_to_code_by_regex#AddOutlineMappings(regex)
Pressing enter will take you to line 17 / 66 etc..
Of course you can also find definitions this way (use let as regex and you'll get)
19 let ft = &filetype
20 let file = expand('%')
21 let window = winnr()
[...]
Pressing <c-o> will take you back
I'v put some minor effort into higlighting the regular expression match. Thus you can use zs and ze to higlight special words.
How nice this works depends on the already existing syntax definitions. This can be improved much