大家好,又见面了,我是你们的朋友全栈君。
本文翻译自:How to temporarily exit vim and go back
我怎么能退出Vim,而不是:q,然后回去继续编辑?
参考:https://stackoom.com/question/7SRZ/如何暂时退出vim并返回
You can switch to shell mode temporarily by: 您可以通过以下方式暂时切换到shell模式:
:! <command>
such as 如
:! ls
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
。
Assuming terminal vim on a flavor of *nix: 假设终端vim的风格为* nix:
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
start a subshell using: 使用以下命令启动子shell:
:sh
(as configured by) (由配置)
:set shell?
:!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
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: 为了给您一个简短的总结,以下是您的会话完好不同的退出和退货方法:
您可以使用:sh
退出到您的默认shell,然后在shell提示符下键入$ exit
将返回到vim。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/140551.html原文链接:https://javaforall.cn