The Linux Vim exit method that has troubled countless people is so simple?
As one of the most widely used text editors, Vim has been circulating a mysterious question about it in the programming world. There are few people who know the answer, but it is difficult to tell.
# 点击Esc键进入“普通模式”。然后,您可以键入:以进入“命令行模式”。冒号(:)将出现在屏幕底部,您可以键入以下命令之一。要执行命令,请Enter按键。
· :q # 退出(的缩写:quit)
· :q! # 不保存即退出(的缩写:quit!)
· :wq # 写和退出
· :wq! # 即使文件只有读权限也可以写并退出(如果文件没有写权限:强制写)
· :x # 写入并退出(类似于:wq,但仅在有更改时写入)
· :exit # 写入并退出(与相同:x)
· :qa # 全部退出(的缩写:quitall)
· :cq # 退出而不保存并使Vim返回非零错误(即退出时出现错误)
# 也可以通过输入ZZ保存并退出(与:x)或ZQ直接退出(与:q!)来直接从“普通模式”退出Vim