ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Goto Related

by schreifels ST2/ST3

Jump to similarly named files in Sublime Text

Details

Installs

  • Total 209
  • Win 87
  • OS X 86
  • Linux 36
Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6
Windows 0 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Overview

In a large project, related files often have similar names. Goto Related is a shortcut to show the Goto Anything overlay with the current filename pre-populated.

For example, if you are viewing app/views/rocket_launch.html.erb and press ⌘+., the fuzzy file finder palette appears with rocket_launch pre-populated.*

* This assumes that you have Goto Related configured to strip file extensions.

Installation

You can install the package manually or, if you use Package Control, install “Goto Related”.

Configuration

Discarding patterns

Goto Related can be configured to discard parts of the current filename using regular expressions. This is done in your project settings (Project > Edit Project) or your global settings (Sublime Text > Preferences > Settings - User). For example:

"goto_related_patterns_to_strip": [
    "^_",
    "\\..+$",
    "_spec$",
    "_controller$"
]

will strip leading underscores, file extensions, and a couple suffixes, so:

  • _partial.html.erb becomes partial
  • utilities_helper_spec.rb becomes utilities_helper
  • rocket_launch_controller_spec.rb becomes rocket_launch

Project-level configuration overrides global configuration. The regular expressions are executed in the order they are defined.

Custom key binding

You can change the default keyboard shortcut in Sublime Text > Preferences > Key Bindings - User. This defaults to:

[
    { "keys": ["super+."], "command": "goto_related" }
]

Development

To run the test suite:

pip install -r requirements.txt
python test/test_goto_related.py