FSwitch : Allows switching between companion source files (like a.vim)
| script karma |
Rating 37/15,
Downloaded by 487 |
| created by |
| Derek Wyatt |
| |
| script type |
| utility |
| |
| description |
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.
You can:
- 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. |
| |
| install details |
This is a vimball, so load it up and source it (:so %).
|
| |
script versions (upload new version)
Click on the package to download.
| FSwitch-0.9.2.vba |
0.9.2 |
2009-10-10 |
7.0 |
Derek Wyatt |
Fix to the split commands (Thanks to Michael Henry) |
| FSwitch-0.9.1.vba |
0.9.1 |
2009-03-25 |
7.0 |
Derek Wyatt |
See :h fswitch-changes
Added :ifrel and :ifabs location directives
Exposed two public functions for retrieving the companion file in a script
Changed defaults for c/c++ code to use :ifrel instead of :rel |
| FSwitch-0.9.0.vba |
0.9.0 |
2009-03-24 |
7.2 |
Derek Wyatt |
Initial upload |
|