FSwitch : Allows switching between companion source files (like a.vim)
| script karma
Downloaded by 4039
Comments, bugs, improvements
|This script is designed to switch between companion files much like vimscript #31 (a.vim).
Out of the box it will support C and C++ for most usages, unless you've got an interesting setup I haven't guessed.
- switch the file and keep it in the current window with :FSHere
- switch the file and put it in the window to the left with :FSLeft
- switch the file, split the window to the left and put it there with :FSSwitchLeft
- the same can be done with Right, Above and Below.
The switch function should be easy enough to call in different ways that give you more exotic behaviour.
Using the location directive, you can be quite specific about how the companion file is resolved and, more importantly how it's created when it doesn't exist. This latter bit was apparently a sore point with a.vim and I hope that it's acceptable in FSwitch.
You can state locations as being the result of
- a regular expression substitution
- a globbed match
- a relative path (either unconditionally or only if the current buffer's path matches a required pattern)
- an absolute path (either unconditionally or only if the current buffer's path matches a required pattern)
Using an autocmd to set the buffer-local variables allows you great flexibility in specializing the behaviour of FSwitch.
There are also a couple of public functions you can use to retrieve the companion file for use in your own functions as well.
This script is now maintained at https://github.com/derekwyatt/vim-fswitch
|I've put this in a format that's easiest to use with pathogen (vimscript #2332). Just unzip it in the right spot (say, ~/.vim/bundle) or unzip it and copy the 'plugin' and 'doc' directories into the right spot in the runtime path (say, ~/.vim).
You can also use package managers that work with GitHub by using the repo https://github.com/derekwyatt/vim-fswitch
Rating scripts is only available on the
script versions (upload new version)
Click on the package to download.
ip used for rating: 22.214.171.124