Ⅰ. 插件描述
A Source code Explorer for viewing definition(s) and contextual infoⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/source-explorer-srcexpl-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/source-explorer-srcexpl-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/source-explorer-srcexpl-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/SrcExpl
Ⅳ. 文档说明
[GitHub]
The latest dev version of Source Explorer and screenshots can be downloaded from GitHub Homepage:
https://github.com/wesleyche/SrcExpl
[Introduction]
SrcExpl (Source Explorer) is a source code explorer that provides context for the currently selected keyword by displaying the function or type definition
or declaration in a separate window. This plugin aims to recreate the context window available in the IDE.
For example, you put the cursor on a function name in the Normal mode, its definition will show on the Source Explorer window a moment later. As soon as you do the 'double-click' operation using your mouse onto the Source Explorer window which had appeared on the bottom of (G)Vim, the definition and its context will be shown on the editor window. In srcexpl v1.2 and above, the function key which users mapped will play a important role that you can not only use mouse but also use keyboard in order to exploring source code in both GUI and cterm VIM.
The Source Explorer can work with 'Taglist' and 'NERD tree' very well. Both of them make (G)Vim looks like the IDE in Unix/Windows/Mac enviroment.
[Features]
1 Go insight the definitions of functions and various types of C/C++/Java language project, including function, marcos, structure, array, method, class, global variable, local variable etc.
2 Double click using left mouse and your own map key (such as: <ENTER>) onto the Source Explorer window can go forward to the preview context.
3 Popup menu and Your own map key to go back from the preview context.
4 Auto create and update the 'tags' file intelligently.
[Tips]
1 Ensure that there is only one 'tags' file in your project PATH, or it would make VIM load all of them on the same time. For example: There are two tags file in the 'your_project' directory, so we will delete the excess 'tags' file in the 'sub_directory'.
... ...
[chewenlong@localhost ~]$ cd your_project/
[chewenlong@localhost your_project]$ pwd
/home/chewenlong/your_project
[chewenlong@localhost your_project]$ ls
bar.c sub_directory tags
[chewenlong@localhost your_project]$ cd sub_directory/
[chewenlong@localhost sub_directory]$ ls
foo.c tags
[chewenlong@localhost sub_directory]$ rm -rf tags
[chewenlong@localhost sub_directory]$ ls
foo.c
[chewenlong@localhost sub_directory]$ cd ..
[chewenlong@localhost your_project]$ ls
bar.c sub_directory tags
[chewenlong@localhost your_project]$ vim bar.c
... ...
2 Make sure the files you are exploring is unix-format, that is, there is no 'r'(displayed as '^M') at the end of each line. Because the plugin would make a jump mistake when executing EX-commands.
3 If you want your VIM works like the IDE, just try a VIM plugin named 'Trinity (trinity.vim)':
https://www.vim.org/scripts/script.php?script_id=2347
This simple plugin can manage 'Source Explorer', 'Taglist' and 'NERD Tree' work together very well.
If you want to use VIM with Source Explorer in the UNIXs-console, I suggest map the keys below to jump from one window to another.
nmap <C-H> <C-W>h
nmap <C-J> <C-W>j
nmap <C-K> <C-W>k
nmap <C-L> <C-W>l
Below key mappings can replace the Vim feature for jumping to previously visited locations via jump list.
nmap <C-I> <C-W>j:call g:SrcExpl_Jump()<CR>
nmap <C-O> :call g:SrcExpl_GoBack()<CR>
The typical actions using srcexpl.vim are:
a Move the cursor onto a symbol word.
b As soon as the definition of the word is displayed on the preview window, we type <Ctrl-j> to jump into the previw window.
c Type the SrcExpl_jumpKey(<ENTER> as default) to jump to the exact context of its definition.
d Type the SrcExpl_gobackKey(<SPACE> as default) to go back to the previous position of the symbol word.