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

Copy Cut and Paste Lines

by AlanLynn ST3

Copies and cuts partially selected lines as full lines.

Details

Installs

  • Total 880
  • Win 566
  • Mac 156
  • Linux 158
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 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8
Windows 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 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 1 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
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 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Copy Cut and Paste Lines - Package for Sublime Text

The purpose of this package is to improve your coding efficiency.

It does that by replacing the default Copy, Cut, and Paste with new versions that treat partially selected lines of code as fully selected. This makes it easier to copy/cut/paste full lines of code. And because moving lines of codes is such a common operation, making it even a little easier has a big benefit.

In case you need to use the original versions of copy/cut/paste, they are bound to new shorctuts.
Original Copy: Ctrl+Alt+C Original Cut: Ctrl+Alt+X Original Paste: Ctrl+Alt+V
If you don't like these bindings, set your own in Key Bindings - User. (See section Rebinding Keys.)

Demonstration

Cutting and pasting lines:
Demonstration gif

Potential Downsides

  • There are some scenarios when you don't want to cut/copy/paste lines, for example using rectangular selection. In this case, use the rebound shortcuts listed above.
  • No entries are created in the paste history list.

How to Install

  1. Install Package Control if you do not already have it.
  2. In Sublime Text, open the Package Control command pallete. (Preferences → Package Control)
  3. Select “Install Package”.
  4. Search for Copy Cut and Paste Lines, and select it.

Rebinding Keys

If you don't like the default key bindings, paste the code below into Key Bindings - User and edit the keys to your liking.

// Key bindings for the "improved" copy, cut, paste, and duplicate commands:
{ "keys": ["ctrl+c"], "command": "ccpl_copy" },
{ "keys": ["ctrl+x"], "command": "ccpl_cut" },
{ "keys": ["ctrl+v"], "command": "ccpl_paste" },
{ "keys": ["ctrl+shift+d"], "command": "ccpl_duplicate" },
// Key bindings for the original copy, cut, paste, and duplicate commands:
{ "keys": ["ctrl+alt+c"], "command": "copy" },
{ "keys": ["ctrl+alt+x"], "command": "cut" },
{ "keys": ["ctrl+alt+v"], "command": "paste" },
{ "keys": [""], "command": "duplicate_lines" },