⚠ I've ported a leaner version of this to lua toggle-bool.nvim
This is a very simple Vim plugin built on top of switch.vim that can be used to toggle various boolean values. The following toggles are made:
True
←→False
Yes
←→No
On
←→Off
1
←→0
Enable(d)
←→Disable(d)
First
←→Last
Before
←→After
Persistent
←→Ephemeral
Internal
←→External
Ingress
←→Egress
Allow
←→Deny
All
←→None
The toggle works for the first match on the current line and does not change the cursor position. Upper, lower and capitalised case are supported and retained.
Install can be done via a plugin manager. Additionally switch.vim needs to be installed as well.
For vim-plug it's:
Plug 'AndrewRadev/switch.vim'
Plug 'gerazov/vim-toggle-bool'
The plugin creates a single command ToggleBool
. An example keymapping is:
nnoremap <silent> <Leader>s :ToggleBool<CR>
Toggling is done via switch.vim and is needed to be installed.