More exhaustive Switch File functionality for the C-family
- Total 1K
- Win 537
- Mac 207
- Linux 287
|Nov 29||Nov 28||Nov 27||Nov 26||Nov 25||Nov 24||Nov 23||Nov 22||Nov 21||Nov 20||Nov 19||Nov 18||Nov 17||Nov 16||Nov 15||Nov 14||Nov 13||Nov 12||Nov 11||Nov 10||Nov 9||Nov 8||Nov 7||Nov 6||Nov 5||Nov 4||Nov 3||Nov 2||Nov 1||Oct 31||Oct 30||Oct 29||Oct 28||Oct 27||Oct 26||Oct 25||Oct 24||Oct 23||Oct 22||Oct 21||Oct 20||Oct 19||Oct 18||Oct 17||Oct 16|
A simple plugin that “takes over” the menu item in Goto -> Switch File -> Switch Header/Implementation. Actually, it takes over the command that gets invoked by that menu item.
Just use Switch Header/Implementation like you normally would. That is, either from the menu item in Goto -> Switch File -> Switch Header/Implementation, or by its keybinding, whatever that may be.
For example, if your header file lives in
and your implementation file lives in
then this plugin will actually do the switch.
Two Modes of Operation
When you're in folder mode (you have not opened a
then the plugin will traverse parent directories. A sanity limit of going up
three parent directories is in place. You can change this number in the
settings of the plugin, but do not make this number too high, or Sublime might
If your code base looks like this:
$project_path/include/foo/bar.hpp $project_path/include/foo/baz/bar.hpp $project_path/src/bar.cpp
then switching from
src/bar.cpp, you'll most likely end up in
include/foo/bar.hpp, as that's the first good match. This is the downside of
When you're in project mode (you have opened a
then the plugin will assume that the project file is at the root of the
directory, and the search will start there. All candidate files are collected,
and if there's more than one candidate file, a quick panel will pop up asking
you to select the correct file. From that point on the plugin will always
choose your selection for switching. This mode is much more powerful. Use the
power of the sublime project file.
The plugin might come up with false positives. For example, if your code base looks like this:
$project_path/include/awesome/foo.hpp $project_path/include/awesome/bar/foo.hpp $project_path/src/bar/foo.cpp
then switching from
include/awesome/foo.hpp, it will open
src/bar/foo.cpp is probably paired with