I often call
:set spell
only to immediately call
:set nospell
once I've corrected the word I was unsure of.
I can make this faster by mapping both commands, but I'm looking for a more general way to speed this up. Is it possible to undo the last option :set?
VIM mode - Ctrl+D cursor then deletes the line.
You can use the u button to undo the last modification. (And Ctrl + R to redo it).
I don’t know that you can undo the setting of an option, but in the case of an on / off option such as spell
, you can toggle it with a !
at the end of the option name:
:set spell!
Strictly speaking, no, you cannot undo setting a setting in Vim.
But boolean options like 'spell'
can be toggled with either one of
:set spell!
:set invspell
In interactive use there is generally no need to specifically :set spell
or :set nospell
. Toggling is more convenient and can be immediately "undone" with the @:
command.
Non-boolean options can be undone by resetting them to their factory values – say, if you have messed up some setting and wish to revert. Example:
:set formatoptions&
A &
appended to the option name resets it to its default value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With