Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Toggle BooleanNew to Visual Studio Code? Get it now.
Toggle Boolean

Toggle Boolean

silesky

|
12,566 installs
| (9) | Free
Quickly toggle boolean values. Inspired by the vim plugin, toggle-bool.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Toggle Boolean

Inspired by the vim plugin, toggle-bool

  • Easily toggle between booleans (i.e. true and false).
  • Toggles selected boolean(s), or just the boolean that's beneath the cursor.
  • Default keybinding: alt+b (or set a custom one).

List of boolean values by default

  • true <-> false
  • yes <-> no
  • on <-> off
  • 0 <-> 1

Keybinding

  • Extension adds the following keybinding.
// Copy to your `keybindings.json` and customize to override.
{
  "key": "alt+b",
  "command": "extension.toggleBool",
  "when": "editorTextFocus"
}

Custom boolean mapping

  • You can override the default boolean mapping.
 // Boolean mappings can be set in settings.json
  ...
  "toggleboolean.mapping": {
    "true": false,
    "false": true,
    "yes": "no",
    "no": "yes",
    "on": "off",
    "off": "on"
  },

Mappings are defined in both directions, so you can create a linear state machine.

  ...
  "toggleboolean.mapping": {
    "0": 1,
    "1": 2,
    "2": 3,
    "3": 0
  },

Links

  • VS Marketplace Link.
  • Github Link.

Development

npm install
npm run test
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft