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

Goto Related

by schreifels ALL

Jump to similarly named files in Sublime Text

Details

Installs

  • Total 368
  • Win 160
  • Mac 139
  • Linux 69
Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 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
Windows 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
Mac 0 0 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 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

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