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

Move By Symbols

by abusalimov ST2/ST3

Sublime Text plugin for jumping between symbols up and down

Details

Installs

  • Total 1K
  • Win 619
  • OS X 408
  • Linux 309
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 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30
Windows 1 1 3 2 1 1 3 1 2 0 1 0 0 3 1 2 1 1 0 0 2 0 1 1 0 0 0 1 0 0 0 2 0 0 1 0 1 1 0 0 1 0 2 0 0 2
OS X 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0
Linux 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 2 0 0 0 0 1 1 0 0 0 0 0 0 0 1

Readme

Source
raw.​githubusercontent.​com

Sublime Move By Symbols

Sublime Text plugin for navigating by symbols of current file up and down.

This is how it works with default settings out of the box.

Animation

Installation

Package Control

With Package Control installed: - Open Command Palette (ctrl + shift + P or + + P) - Select Package Control: Install Package (pkginst) - Search for Move By Symbols (mbsym) package and install it

Manual

Locate Sublime Text Packages directory (Preferences → Browse Packages…) and clone this repository there:

git clone https://github.com/abusalimov/SublimeMoveBySymbols.git "Move By Symbols"

Usage

Two keybindings are provided by default:

OSX Linux / Windows
Previous Symbol ctrl + up alt + up
Next Symbol ctrl + down alt + down

Also a mouse wheel can be used insead of up/down keys, with the same modifiers.

Customization

The main command is move_by_symbols, it takes two boolean arguments:

  • forward: bool, mandatory
    Move direction
  • extend: bool, default is false
    Controls whether to retain current selection or not

Settings files

All available options are listed below. You can also refer to Preferences → Package Settings → Move By Symbols → Settings – Default to get the list of all settings with their description and fallback defaults.

Options are read in the following order (last match always wins): - Package settings - Sublime settings - Command arguments

Package settings

These settings have the least priority and can be used to modify options globally. For example, to disable showing a symbol in the status bar, open Packages/User/Move By Symbols.sublime-settings file (Preferences → Package Settings → Move By Symbols → Settings – User), and add:

{
    "show_in_status_bar": false
}

Sublime settings

Sublime settings chain is handled as described in the documentation:

  • Packages/User/Preferences.sublime-settings
  • Project Settings
  • Packages/User/<syntax>.sublime-settings

To avoid global namespace pollution all related settings are specified with MoveBySymbols. prefix.

For example, to modify navigation through Diff files so that only names of changed files are included (without selecting diff sections) and to make file names more conspicuous while navigating, create Packages/User/Diff.sublime-settings file (or open it while editing a diff file with Preferences → Settings – More → Syntax Specific – User) and add these lines:

{
    "MoveBySymbols.symbol_selector": "meta.toc-list.file-name.diff",
    "MoveBySymbols.highlight_style": "fill",
    "MoveBySymbols.highlight_scope": "string"
}

Command arguments

Arguments passed to the move_by_symbols command override everything above.

For example, to add a shortcut (with, say, ctrl modifier) for navigating between classes only, add the following to Packages/User/Default (<platform>).sublime-keymap (Preferences → Key Bindings – User):

[
    { "keys": ["ctrl+alt+up"],   "command": "move_by_symbols",
            "args": {"forward": false, "symbol_selector": "entity.name.type"}},
    { "keys": ["ctrl+alt+down"], "command": "move_by_symbols",
            "args": {"forward": true,  "symbol_selector": "entity.name.type"}}
]

Available settings

The following options contol the package behavior:

  • symbol_selector: string, default is null, example value: "entity.name"
    If not specified (default), a symbol index is used (shown by ctrl + R outline). Some syntax bundles (like Python) override symbol selector to get more neat outline by adding extra indentation or list of arguments. However, it is much more convenient to navigate by selecting symbol names (identifiers) only, without a surrounding text. Designed to be customized on a per-syntax basis using MoveBySymbols.symbol_selector setting.

  • force_single_selection: bool, default is false
    Setting this option to true discards all selections except the first or last one depending on the direction used.

  • show_in_status_bar: bool, default is true
    If a single symbol is selected, show its name in the status bar.

  • highlight: bool, default is true
    Highlight symbols while navigating.

  • highlight_scope: string, default is null, example value: "string"
    If not specified (default), use a foreground color of the symbol itself. If you want all symbols to be painted with the same color, set this option to the name of the desired scope, for example “string”, or “comment”.

  • highlight_style: one of "outline" or "fill", default is "outline"
    Controls how symbols are highlighted.

  • highlight_timeout: int, default is 1500
    Time in milliseconds before highlighting automatically disappears.