Skip to content

gerazov/toggle-bool.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

toggle-bool.nvim

This is a minimal Neovim plugin that can be used to toggle various boolean-like values.

toggle-bool

The toggles included by default are:

  • False ←→ True
  • false ←→ true

The toggle works for the first match on the current line starting at the cursor position.

Additional toggles can be setup by the user.

This plugin is a Lua port of the Vim version gerazov/vim-toggle-bool.

Setup

The plugin can be installed via a plugin manager.

For packer.nvim it's:

use 'gerazov/toggle-bool.nvim'

To setup the plugin run:

require("toggle-bool").setup {
  mapping = "<leader>tt",
  additional_toggles = {
    Yes = 'No',
    On = 'Off',
    ["0"] = "1",
    Enable = 'Disable',
    Enabled = 'Disabled',
    First = 'Last',
    Before = 'After',
    Persistent = 'Ephemeral',
    Internal = 'External',
    Start = 'Stop',
    In = 'Out',
    Open = 'Close',
    Enter = 'Exit',
    Lock = 'Unlock',
    Connect = 'Disconnect',
    Mount = 'Dismount',
    Import = 'Export',
    Ingress = 'Egress',
    Allow = 'Deny',
    All = 'None',
  },
}

Usage

The plugin exposes a single function toggle_bool that is mapped to the specified mapping.

Alternatively, it can be called via:

:lua require("toggle-bool").toggle_bool()

Similar plugins

About

A simple plugin to toggle bools in nvim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages