elentok/togglr.nvim

github github
pluginediting-supportutility
stars 6
issues 0
subscribers 3
forks 2
CREATED

2013-10-14

UPDATED

7 months ago


Togglr

Togglr is a Neovim plugin that toggles boolean values (by pressing <Leader>tw in normal mode):

  • true ↔ false
  • on ↔ off
  • enabled ↔ disabled
  • left ↔ right
  • top ↔ bottom
  • margin-left ↔ margin-right
  • etc...

Installation

Using Lazy:

{
  "elentok/togglr.nvim",
  opts = {}
}

You can also customize the settings:

{
  "elentok/togglr.nvim",
  opts = {
    -- Specify key map (set to false or nil to disable)
    key = "<Leader>tw",

    -- Specify which register to use (to avoid overriding the default register)
    register = "t",

    -- Enable debugging mode
    debug = true,

    -- Add custom sets to values to toggle between
    values = {
      ["value"] = "opposite-value",
    },
  },
}

Using Packer:

use {
  'elentok/togglr.nvim',
  config = function()
    require('togglr').setup({
      -- options
    })
  end
}

If after the initial setup you want to add more values:

require('togglr').add('value', 'opposite-value')

To trigger the toggling manually:

require('togglr').toggle_word()