Toggle : allows you to toggle bool (true/false) and other words with a shortcut
| script karma
Downloaded by 1700
Comments, bugs, improvements
script versions (upload new version)
|In this version, the script can toggle:
true <-> false
on <-> off
yes <-> no
define <-> undef
+ <-> -
> <-> <
&& <-> ||
& <-> |
positive and negative numbers
Move the cursor on the word/char/number to be toggled and press
<C-T> in insert mode
+ in normal / visual mode.
This shortcut can be modified in the script file - of course...
If the cursor is positioned on a number, the script looks for a corresponding + or - sign for that number.
If it's found, it will be replaced by the other one. If none is found, a - sign is inserted before the number.
|put this plugin into your ~/.vim/plugin folder or source it in your ~/.vimrc|
Click on the package to download.
ip used for rating: 22.214.171.124
||- Keeps the keyword case when toggling (thanks to Jan Christoph Ebersbach for this code)
- bugfix for && and || toggling
||default mapping uses + in normal and visual mode instead of <C-T>
added toggle entries: && <--> || and & <--> |
||I added define/undef as new words.
I added a mapping for visual mode (it actually quits visual mode and calls the Toggle function. But now it works, if you clicked with the mouse on the word and accidentally switched on visual mode...)
I realised that <C-S-T> is the same than <C-T> I didn't intent to break these mappings, but since I didn't find another suitable keymapping, I now use <C-T>. Anyone who doesn't like that can change that easily.