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