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
  • 1 hour ago
  • 6 years ago

Installs

  • Total 4K
  • Win 3K
  • OS X 936
  • Linux 724
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 Jan 6 Jan 5 Jan 4 Jan 3
Windows 0 1 2 1 2 0 0 2 0 3 1 0 0 0 1 0 1 0 0 0 3 1 4 1 1 1 2 0 0 0 1 0 3 2 0 1 1 1 0 1 2 0 2 1 0 2
OS X 0 1 2 0 0 0 0 0 0 0 4 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 3 1 1 0 0 1 2 0 1 1 0 1 0 0 0
Linux 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 0 0 2 0 0 0 0 1 0 1 1 1 0 0 0

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