Skip to content

usernamehw/vscode-incrementor

 
 

Repository files navigation

This is a fork of https://github.com/nmsmith22389/vscode-incrementor

Demo

Features

Numbers

Numbers

Numbers can be incremented or decremented by 1, 0.1, or 10. This works with integers, decimals, and negatives alike. The only real condition is that it is a finite number.

Enumerators

Enumerators

Enumerators can basically be any kind of text, like a variable or function or command.

They can only contain letters, numbers and dashes and must start with a letter and can't end with a dash.

In the extension settings you can add an array of strings that you want to cycle through. i.e. ["false", "true"]

Each array will cycle through the containing strings from beginning to end and also loop back around if you have the option set. Each array is considered a separate enumerator so "false" can only become "true" and vice versa depending what the array contains.

Multiple Selections

Multiple Selections

Incrementor supports multiple selections, even in the same line. They do not all have to be the same type, so one selection/cursor could be a number and another could be an enumerator.

Usage

TIP: Incrementing/decrementing can work with one or multiple cursors.
If there are no selections Incrementor will use the word under the caret(s) then select them.

For this example we will be incrementing a number.

  1. Either select the number you wish to increment or just place the caret inside or next to the number.

  2. Then, either press the hotkey that corresponds to the value you wish to increment by or open the Command Palette and use the command Incrementor: Increment by X.

  3. Congratulations! You just Incrementored your first number!

Increment by custom value example:

When command is executed from Command Palette - it will prompt for the custom value

{
    "key": "ctrl+Up",
    "command": "incrementor.incByCustomValue",
    "args": 20
},
{
    "key": "ctrl+Down",
    "command": "incrementor.incByCustomValue",
    "args": -20
},

Commands (7)

Command Description
incrementor.incByCustomValue Incrementor: Increment by custom value
incrementor.incByOne Incrementor: Increment by 1
incrementor.decByOne Incrementor: Decrement by 1
incrementor.incByTenth Incrementor: Increment by 0.1
incrementor.decByTenth Incrementor: Decrement by 0.1
incrementor.incByTen Incrementor: Increment by 10
incrementor.decByTen Incrementor: Decrement by 10

Settings (3)

Setting Default Description
incrementor.decimalPlaces 0 The number of decimal places to round incremented/decremented decimal numbers to.
(a value of 0 will disable rounding)
incrementor.enums [["true","false"],["let","const"]] A group of arrays, each containing a list of enums to cycle through.
incrementor.loopEnums true After reaching the end of an Enum set, start back at the beginning.

Keybindings

Keybindings aren't being included but can be assigned by user:

{
    "command": "incrementor.incByOne",
    "key": "ctrl+up"
},
{
    "command": "incrementor.decByOne",
    "key": "ctrl+down"
}

Packages

No packages published

Languages

  • TypeScript 92.6%
  • JavaScript 7.4%