如何暂时退出vim并返回

如何暂时退出vim并返回我怎么能退出Vim,而不是:q,然后回去继续编辑?

大家好,又见面了,我是你们的朋友全栈君。

本文翻译自:How to temporarily exit vim and go back

我怎么能退出Vim,而不是:q,然后回去继续编辑?


#1楼

参考:https://stackoom.com/question/7SRZ/如何暂时退出vim并返回


#2楼

You can switch to shell mode temporarily by: 您可以通过以下方式暂时切换到shell模式:

:! <command>

such as

:! ls

#3楼

If you are on a unix system, ctrl-Z will suspend vim and give you a shell. 如果你在unix系统上, ctrl-Z将暂停vim并给你一个shell。 Type fg to go back. 输入fg返回。 Note that vim creates a swap file while editing, and suspending vim wouldn’t delete that file (you aren’t exiting vim after all). 请注意, vim在编辑时会创建一个交换文件,暂停vim不会删除该文件(毕竟你不会退出vim)。 On dumb terminals, this method was pretty standard for edit-compile-edit cycles using vi . 在哑终端上,这种方法对于使用vi编辑 – 编译 – 编辑循环来说是非常标准的。 I just found out that for me, gvim minimizes on typing ctrl-Z . 我刚刚发现,对我来说, gvim最小化输入ctrl-Z


#4楼

Assuming terminal vim on a flavor of *nix: 假设终端vim的风格为* nix:

To suspend your running vim 暂停正在运行的vim

Ctrl + Z Ctrl + Z.

will suspend the process and get back to your shell 将暂停该过程并返回到您的shell

fg

will resume (bring to f ore g round) your suspended vim 将恢复(带至f矿石轮)暂停的VIM

To start a new shell 开始一个新的shell

start a subshell using: 使用以下命令启动子shell:

:sh

(as configured by) (由配置)

:set shell?

or 要么

:!bash

followed by: 其次是:

Ctrl + D (or exit , but why type so much?) Ctrl + D (或exit ,但为什么键入这么多?)

to kill the shell and return to vim 杀死shell并返回vim


#5楼

There are several ways to exit vim and have every thing the same when you return. 有几种方法可以退出vim,并在返回时让每件事情都相同。 There is very good documentation within vim itself explaining the various ways this can be done. 在vim中有非常好的文档,解释了可以这样做的各种方法。 You can use the following command within vim to access the relevant help page: :help usr_21 您可以在vim中使用以下命令来访问相关的帮助页面:help usr_21

To give you a brief summary, here are the different methods of quitting and returning with your session intact: 为了给您一个简短的总结,以下是您的会话完好不同的退出和退货方法:

  1. Suspend and resume – You don’t actually quit vim with this, you simply hide your session in the background until you need it. 暂停和恢复 – 你实际上并没有退出vim,你只需在后台隐藏你的会话,直到你需要它为止。 If you reset your computer or issue a kill command to vim, you will lose your session. 如果您重置计算机或向vim发出kill命令,则会丢失会话。 This is good for when you want to switch to another task temporarily, but if this is the case, then you might want to look into using the GNU Screen utility instead. 当你想暂时切换到另一个任务时,这很有用,但如果是这种情况,那么你可能需要考虑使用GNU Screen实用程序

  2. Sessions – This is the true way of saving your session between instances of vim. 会话 – 这是在vim实例之间保存会话的真正方法。 Even if you truly quit vim, your session will be there for you when you return. 即使你真的放弃了vim,当你回来时,你的会话也会在那里。 This is probably what you are looking for. 这可能就是你要找的东西。


#6楼

您可以使用:sh退出到您的默认shell,然后在shell提示符下键入$ exit将返回到vim。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/140551.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 单射、满射和双射(一 一映射)[通俗易懂]

    单射、满射和双射(一 一映射)[通俗易懂]设映射f:A→B,如果A中不同的元素的像都不相同,则f称为单射;如果A中元素的像充满了像集B,即B中的元素都有原像,则f称为满射;如果f既是单射,又是满射,则f称为双射,双射也叫一一映射。…

    2022年5月3日
    250
  • 关于文件夹病毒exe的处理方法_文件夹自动生成快捷方式病毒

    关于文件夹病毒exe的处理方法_文件夹自动生成快捷方式病毒最近,因为U盘用的比较频繁,所以经常会感染到病毒,最常见的就是原来的文件夹后面增加了扩展名,变成了可执行文件。如原文件夹为“老舍”,感染病毒后变为“老舍.exe”。大小为665.KB。但是这种病毒不影响文件夹中文件的使用,只会影响文件夹的复制,粘贴,且它只存在在第一层目录中,后面的就没有影响。我给出的解决办法(只针对U盘)是:下载DirFixer.exe,并运行。这样会恢复出原来的文件夹,且e

    2025年7月2日
    4
  • php中_initialize()函数与 __construct()函数的区别说明

    php中_initialize()函数与 __construct()函数的区别说明

    2022年2月8日
    53
  • VS2010旗舰版下载

    VS2010旗舰版下载下面这个可用下载:大小2.5Ghttp://download.microsoft.com/download/E/0/4/E0427BB8-8490-4C7F-A05B-AFEA0FC3EA80/X16-60997VS2010UltimTrialCHS.iso//下面没怎么管MicrosoftVisualStudio2010旗舰版(vs2010…

    2022年7月20日
    21
  • androidrepublic_android develop

    androidrepublic_android developPreferenceFragment用来显示首选项的设置,效果图如下:主布局文件:<RelativeLayoutxmlns:android=”http://schemas.android.com/apk/res/android”xmlns:tools=”http://schemas.android.com/tools”android:…

    2022年9月6日
    4
  • 程序员即装逼又实用的Cmd命令行

    程序员即装逼又实用的Cmd命令行首先windows键+R(+R)打开运行,输入cmd回车打开命令行。1、cleanmgr选择盘符清理垃圾,能加快电脑运行速度。2、chkdsk磁盘检查,能检查磁盘是否有损害。3、devmgmt打开设备管理器4、dxdiag打开DirectX诊断工具,买二手电脑是避免黑商修改电脑配5、ping:ping192.168.0.1判断某台电脑是否能连…

    2022年5月20日
    74

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号