In vim (I use gVim under Windows), we know that u is the command to undo the last editing operation. Is there a command to undo the last command line operation? For example, after I type: set list, I want to cancel the operation directly. Is there any other more direct shortcut keys and commands without typing: set nolist?
If you want to ask about key mapping, there is really no key mapping. However, in the specific example you gave, you can use
:set list!
to switch the switch state. In fact, most vim options can be switched in this way, so you can also use commonly used keys. mapped to the keys, which will be much more convenient. Tim Pope has written a plug-in called unimpaired. This plug-in pre-maps many of these switching commands for you, which is very helpful to improve efficiency.To be more prepared,
u
is to undo the last modification operation. The so-called modification operation refers to changing the text, including the text content and text position.On this basis, such as
:s
replacement operation and command line operation, the text has been changed, so:s
替换操作, 命令行操作, 改变文本了, 所以u
can be restored.But
does not work.:set
是设置编辑器特性, 并不属于修改操作, 不改变文本, 所以u
is setting editor features, it is not a modification operation and does not change the text, so:set
There is no other shortcut for