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

Duplicate​Selections

If you have an equal number of empty selections (cursors) and selections, this command will place each selection at the corresponding cursor location.

Details

  • 2 2013.07.09.15.17.47
    3 2.1.0
  • github.​com
  • github.​com
  • 3 years ago
  • 2 hours ago
  • 6 years ago

Installs

  • Total 4K
  • Win 2K
  • OS X 890
  • Linux 675
Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1
Windows 7 3 1 1 0 1 7 4 2 1 4 1 4 11 7 1 1 2 4 0 3 2 1 3 3 0 1 4 0 1 2 2 0 2 2 2 0 0 1 1 4 1 2 2 1 2
OS X 0 0 0 0 1 1 0 0 0 0 0 1 0 2 0 0 1 1 0 2 2 1 0 0 2 0 2 1 5 1 2 4 2 0 1 0 0 0 1 0 0 0 0 0 0 0
Linux 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0 1 2 0 0 0 0 1 0 0 0 0 0 1 0 4 1 1 0 0 0 0 0 1 1 0 0 1

Readme

Source
raw.​githubusercontent.​com

DuplicateSelections

I wrote and use this plugin as an alternative to copy and pasting.

First, you can use this command to duplicate the current line (or lines).

Another common use case is when you need to copy some small bit of text, like a variable or method name.

Select the text to copy, then cmd+click to place an empty cursor, then run this command to insert the selected text at the cursor position.

This can be extended to multiple selections: if you have an equal number of selections and cursors, this command will place each selection at the corresponding cursor location.

Or, you can select some text and place multiple empty cursors, and the selection will be inserted at all the cursor locations.

Example:

Example.mp4

Installation

  1. Using Package Control, install “DuplicateSelections”

Or:

  1. Open the Sublime Text Packages folder

    • OS X: ~/Library/Application Support/Sublime Text 3/Packages/
    • Windows: %APPDATA%/Sublime Text 3/Packages/
    • Linux: ~/.Sublime Text 3/Packages/ or ~/.config/sublime-text-3/Packages
  2. clone this repo

  3. Install keymaps for the commands (see Example.sublime-keymap for my preferred keys)

Commands

duplicate_selections: See description above