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 369
  • Win 160
  • Mac 140
  • Linux 69
May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 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
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 0 0 0 0 0 0 0 0 0 0 0 0 1 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
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 1 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