Vim for Windows - 我应该输入什么来保存并退出文件?
使用 Windows XP 我不小心输入了 git commit -a
而不是 git commit -am "My commit message"
,现在我正在查看充满该文件的 CMD 提示符我的提交消息的版本(“请输入您的提交消息...”)。我已将消息添加到顶部,但现在我不知道如何保存和离开。我尝试按 Ctrl + W + Q,但它没有执行任何操作,但在其中添加 ^
光标是。
我也先尝试了 Esc,然后 Ctrl + W + Q,但它说 No write自上次更改以来(添加!以覆盖)
。
Using Windows XP I accidentally typed git commit -a
instead of git commit -am "My commit message"
, and now I'm viewing my CMD prompt filled with the file version of my commit message ("Please enter the commit message for your..."). I've added my message to the top, but now I can't figure out how to save and leave. I tried to press Ctrl + W + Q, but it doesn't do anything, but add ^
where the cursor is.
I also tried Esc first, and then Ctrl + W + Q, but it says No write since last change (add ! to override)
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
按 ESC 确保退出编辑模式,然后键入:
Press ESC to make sure you are out of the edit mode and then type:
我可以为您提供,而不是告诉您如何执行某个命令(Esc:wq)两个可以帮助您使用 VIM 的链接:
但是,学习 Vim 的最佳方法不仅是使用它进行 Git 提交,还可以将其用作您的常规编辑器。日常工作。
如果你不打算切换到 Vim,记住它的命令是没有意义的。在这种情况下,请执行 设置您最喜欢的编辑器以与 Git 一起使用。
Instead of telling you how you could execute a certain command (Esc:wq), I can provide you two links that may help you with VIM:
However, the best way to learn Vim is not only using it for Git commits, but as a regular editor for your everyday work.
If you're not going to switch to Vim, it's nonsense to keep its commands in mind. In that case, go and set up your favourite editor to use with Git.
Esc 确保退出插入模式,然后使用
:wq
(冒号 wq)或ZZ
(shift-Z shift-Z)。Esc to make sure you exit insert mode, then
:wq
(colon w q) orZZ
(shift-Z shift-Z).按
i
或a
进入插入模式,然后键入所选消息按
ESC
多次退出插入模式,或您可能意外遇到的任何其他模式< /p>保存,
:wq
、:x
或ZZ
退出而不保存,
:q!
或ZQ
要重新加载文件并撤消所做的所有更改...:
按几次
ESC
,然后输入:e!.
Press
i
ora
to get into insert mode, and type the message of choicePress
ESC
several times to get out of insert mode, or any other mode you might have run into by accidentto save,
:wq
,:x
orZZ
to exit without saving,
:q!
orZQ
To reload a file and undo all changes you have made...:
Press several times
ESC
and then enter:e!
.更快方法
是
如果您打开了多个文件,您可能需要执行
A faster way to
would be
If you have opened multiple files you may need to do a
:q!
将强制无条件不保存退出:q!
will force an unconditional no-save exit用途:
感叹号用于覆盖只读模式。
Use:
The exclamation mark is used for overriding read-only mode.