Ⅰ. 插件描述
Quick switching between C/C++ header and source filesⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'dschwen/switch-header-source'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'dschwen/switch-header-source'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'dschwen/switch-header-source'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/dschwen/switch-header-source
Ⅳ. 文档说明
# switch-header-source package
Quick switching between corresponding C, C++, Objective-C, and Objective-C++
header and source files...
...Actually between any arbitrarily defined groups of files (as long as you can
match their filenames with a regular expression)!
For example:
- Switch between
.C,.h, and.mdfiles (for implementation, headers, and
class documentation files) - Switch between
.js,.html, and.cssfiles - Your imagination is the limit.. if not, file an issue!

Usage
Mac
Use Ctrl-Option-s to cycle forward though groups of matching files (Shift-Ctrl-Option-s to cycle backwards).
Linux, Windows
Use Alt-o to cycle forward though groups of matching files (Shift-Alt-o to
cycle backwards).
Configuration
The plugin will match each file's name in the project using the [regular
expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
in the Tracked file regular expression setting. If the file name matches it is
added to the group of files that shares the first capture group (this is the
part of the regular expression that was matched in the first pair of
parenthesis).
Let's for example decipher the Tracked file regular expression setting
(.*)\.(h|cpp)$- the
(.*)is the first capture group in this expression (you will see that it
will match the base name of each matching file). - the
\.will match a period (the dot that separates the base name from the
file extension). - the
(h|cpp)means "match a literalhor acppstring" (those are the
file extensions of the files we want to switch between - and you can specify as
many here as you like, e.g. (h|cpp|md)).
- the
$matches the end of the filename (with this we make sure that nothing else
comes after the extension in the filename, like for example a.bakor~,
which would cause the plugin to switch to backup files)
Examples
- Switch between files with three different extensions (
.js,.html,.css)
(.*)\.(js|html|css)$- Switch between a series of files like
output_xi-0,output_xi-1,output_xi-2,
...output_xi-10
(.*)-(\d+)$