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 390
  • Win 170
  • Mac 147
  • Linux 73
Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2
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 1 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 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
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 1 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