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

Smart Duplicate

by roboshoes ALL

Line duplicate plugin that changes .width into .height etc.

Details

  • 2015.02.25.18.16.22
  • github.​com
  • github.​com
  • 9 years ago
  • 2 hours ago
  • 11 years ago

Installs

  • Total 1K
  • Win 731
  • Mac 364
  • Linux 210
May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29
Windows 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
Mac 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 1 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 1 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

SmartDuplicate

SmartDuplicate is a Sublime Text 2 and 3 plug-in that allows duplicating lines while changing certain keywords.

Installation

  • Using Package Controller (recommended): Call Install Package and look for SmartDuplicate.

  • Manually: Clone repo into your packages folder (in Subime: Preferences > Browse Packages… menu item to open this folder).

Command

[CTRL+SHIFT+d] (or [CMD+SHIFT+d] for OSX) duplicates line using smart duplicate

Note: This overwrites the default duplicate line shortcut.

Examples

I wrote the first line of the pairs and hit [CTRL+SHIFT+d].

Grid.WIDTH = window.innerWidth();
Grid.HEIGHT = window.innerHeight();

element.x = other.width + 20 + element.width;
element.y = other.height + 20 + element.height;

target.x = stage.mouseX;
target.y = stage.mouseY;

marginTop: "30px"
marginBottom: "30px"

padding-left: 20px;
padding-right: 20px;

Supported keywords

  • width <-> height (case insensitive)
  • left <-> right (case insensitive)
  • top <-> bottom (case insensitive)
  • .x <-> .y
  • .[word]X <-> .[word]Y (any word ending in a capital X or Y)

Once again: work in progress. Constantly expanding and fine tuning the keywords

Motivation

I'm a front-end developer. It's been too many times that I duplicate a line and then go through and change all the .height to .width etc.. In the manner of automate all the things I thought I write a little plugin for the editor of my choice.

Let me know what you think. No you suck-emails please.