Switch to related files.
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.
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
ftplugin/go.vim for an example.
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.
: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.