Skip to content

A Sublime Text Plugin which enhances editing of multiple selections.

License

Notifications You must be signed in to change notification settings

r-stein/Sublime-MultiEditUtils

 
 

Repository files navigation

Sublime MultiEditUtils Build Status

A Sublime Text 2/3 Plugin which enhances editing of multiple selections. In case you aren't familar with Sublime's awesome multiple selection features, visit this page.

Features

Extend the current selection with the last selection

Sometimes Sublime's standard features for creating multiple selections won't cut it. MultiEditUtils allows to select the desired parts individually and merge the selections with the add_last_selection command (default keybinding is ctrl/cmd+alt+u).

Split the selection

Sublime has a default command to split selections into lines, but sometimes you want to define your own splitting character(s). MultiEditUtils' split_selection command (default keybinding is ctrl/cmd+alt+,) will ask you for a separator and split the selection using your input. An empty separator will split the selection into its characters.

Preserve case while editing selection contents

When multi-selecting all occurences of an identifier it is cumbersome to change it to another one if the case differs (camelCase, PascalCase, UPPER CASE and even cases with separators like snake_case, dash-case, dot.case etc.). The "Preserve case" feature facilitates this. Just invoke "Preserve case" via the command palette (or define an own keybinding) and type in the new identifier.

Normalize and toggle region ends

When creating selections in Sublime, it can occur that the end of the selection comes before the beginning. This happens when you make the selection "backwards". To resolve this, you can normalize the regions with MultiEditUtils' normalize_region_ends command (default keybinding is ctrl/cmd+alt+n). When executing this command a second time, all regions will be reversed.

This feature can also be very handy when you want to toggle the selection end of a single region.

Jump to last region

When exiting multi selection mode, Sublime will set the cursor to the first region of your previous selection. This can be annoying if the regions were scattered throughout the current buffer and you want to continue your work at the last region. To avoid this, just execute MultiEditUtils' jump_to_last_region command (default keybinding is shift+esc) and the cursor will jump to the last region.

Cycle through the regions

In case you want to double check your current selections, MultiEditUtils' cycle_through_regions command (default keybinding is ctrl/cmd+alt+c) will let you cycle through the active regions. This can come handy if the regions don't fit on one screen and you want to avoid scrolling through the whole file.

Strip selection

Sometimes selections contain surrounding whitespace which can get in the way of your editing. The strip_selection command strips the regions so that this whitespace gets removed. The default keybinding is ctrl/cmd+alt+s.

Remove empty regions

When splitting your selection or performing other actions on your selection, it can happen that some regions are empty while others are not. Often only the non-empty regions are of interest. The remove_empty_regions commands will take care of this and remove all empty regions from your current selection. The default keybinding is ctrl/cmd+alt+r.

Quick Find All for multiple selections

Similar to the built-in "Quick Find All" functionality, MultiEditUtils provides a functionality which selects all occurrences of all active selections. The default keybinding of the multi_find_all command is ctrl+alt+f (on Mac it's cmd+alt+j).

Installation

Either use Package Control and search for MultiEditUtils or clone this repository into Sublime Text "Packages" directory.

License

MIT © Philipp Otto

About

A Sublime Text Plugin which enhances editing of multiple selections.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 79.3%
  • JavaScript 20.7%