Ⅰ. 插件描述
Switch to related filesⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'arp242/switchy-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'arp242/switchy-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'arp242/switchy-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/arp242/switchy.vim
Ⅳ. 文档说明
Switch to related files.
Usage: map switchy#switch() to something, for example:
nnoremap <Leader>a :call switchy#switch('split', 'sbuf')<CR>
command! Switch call switchy#switch('split', 'sbuf')
The first function argument is the command to use when editing a file (e.g.edit, split, tabedit, sbuf, etc.), the second argument is the command to
use when the buffer is already loaded. This is useful to switch to an existing
split/tab instead of opening a new one.
You can add your own callbacks with switchy#add(); see
ftplugin/go.vim for an example.
Supported filetypes:
- Go:
a.go↔a_test.go
Yeah, it's early days for this plugin. More filetypes soon™
Survey of existing methods:
- a.vim:
Too many commands, only supports C/C++ out of the box. - FSwitch:
Too many commands, only supports C/C++ out of the box. - vim-altr:
Doesn't load buffer if file doesn't exist, don't like the code (tried to patch
this).
- alternate-lite:
Needs lh-vim-lib, too many commands. - unimpaired.vim:
Kinda works, not really intended for this and can't create new file easily. - Manual:
:e %<.c
nnoremap <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
It's okay, but not as fast as e.g. <Leader>a, also not flexible to multiple
filetypes etc.