退出vim_如何从Vim退出?

退出vim

退出vim

Vim has different and alternative solutions for different requirements. In this tutorial, we will look at different ways to quit or exit and save and exit. In this tutorial, we will use quit and exit for the same thing.

Vim针对不同需求提供了不同的替代解决方案。 在本教程中,我们将研究退出或退出以及保存和退出的不同方法。 在本教程中,我们将对同一件事使用quitexit

从Vim退出或退出 (Exit or Quit From Vim)

The most used and simple usage is just exiting or exiting from the current vim session. If there are changes after opening files this command will not work because this command does not specify action against changes. We will quit by using :q command.

最常用和最简单的用法就是退出当前vim会话。 如果打开文件后发生更改,此命令将不起作用,因为该命令未指定针对更改的操作。 我们将使用:q命令退出。

:q

不保存退出Vim (Exit Vim Without Saving)

We have alternative usage for exiting. As stated previous step we can not quit from vim if the file has unsaved changes. We have :q! command which will quit without saving changes.

我们还有其他用法可以退出。 如前所述,如果文件中有未保存的更改,我们将无法退出vim。 我们有:q! 该命令将退出而不保存更改。

:q!

从Vim写入或保存并退出 (Write or Save and Quit From Vim)

We use write and save statements for the same action. We can not exit vim sessions without saving changes. We can use :wq command where w will save and q will quit. The sequence is important because they run accordingly.

我们对同一操作使用writesave语句。 没有保存更改,我们不能退出vim会话。 我们可以使用:wq命令,其中w将保存, q将退出。 该顺序很重要,因为它们会相应运行。

:wq

OR we can use exit command which will first save the changes and then exit.

或者我们可以使用exit命令,该命令将首先保存更改,然后退出。

:exit

写入并退出甚至没有保存在Vim中 (Write and Quit Even Not Saved In Vim)

Some times files we have opened and changed may be read-only. We can try to save but we will not succeed. So we can provide :wq! command which used to try to save and quit even if the file is not saved.

有时我们打开和更改的文件可能是只读的。 我们可以尝试保存,但不会成功。 所以我们可以提供:wq! 即使未保存文件,该命令也尝试保存并退出。

:wq!

从Vim中所有打开的文件中退出 (Quit From All Opened Files In Vim)

Vim can open multiple files at the same time. One way to close these files is one by one. Another way is closing all files with the qa .

Vim可以同时打开多个文件。 关闭这些文件的一种方法是一种一种。 另一种方法是使用qa关闭所有文件。

:qa
LEARN MORE  How To Move End of File and Line In Vi or Vim?
了解更多信息如何在Vi或Vim中移动文件结尾和行?

翻译自: https://www.poftut.com/how-to-exit-from-vim/

退出vim

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值