如何在 Vim 中运行终端? [英] How do I run a terminal inside of Vim?
问题描述
我习惯了 Emacs,但我正在尝试 Vim,看看我更喜欢哪一个.
I am used to Emacs, but I am trying out Vim to see which one I like better.
我喜欢 Emacs 的一件事是能够在 Emacs 中运行终端.这在 Vim 中可行吗?我知道您可以从 Vim 执行命令,但我希望能够在选项卡内运行终端.
One thing that I like about Emacs is the ability to run a terminal inside Emacs. Is this possible inside of Vim? I know that you can execute commands from Vim, but I would like to be able to run a terminal inside of a tab.
推荐答案
更新答案(11 年后...):
- 如果您选择使用该解决方案,我会建议使用
tmux
而不是screen
,如以下原始答案中所建议的那样. - Vim 8.1 现在有一个内置终端,可以用
:term
命令.这提供了与 Vim 其他功能的更完整的集成. - I would recommend using
tmux
instead ofscreen
as suggested in the original answer below, if you choose to use that solution. - Vim 8.1 now has a built in terminal that can be opened with the
:term
command. This provides much more complete integration with the rest of the Vim features.
Updated answer (11 years later...):
我肯定会推荐 screen
来做这样的事情.Vim 是一个文本编辑器,而不是一个 shell.
I would definitely recommend screen
for something like this. Vim is a text editor, not a shell.
我会使用 Ctrl+AS 来水平分割当前窗口,或者在 Ubuntu 的屏幕和其他补丁版本中,您可以使用 Ctrl+A|(管道)垂直拆分.然后使用 Ctrl+ATab(或在某些系统上等效地使用 Ctrl+ACtrl+I,这可能是更容易输入)以在窗口之间切换.还有其他命令可以更改窗口的大小和排列.
I would use Ctrl+AS to split the current window horizontally, or in Ubuntu's screen and other patched versions, you can use Ctrl+A|(pipe) to split vertically. Then use Ctrl+ATab (or equivalently on some systems, Ctrl+ACtrl+I which may be easier to type) to switch between the windows. There are other commands to change the size and arrangement of the windows.
或者 screen
的一个不太高级的用法就是打开多个全屏窗口并在它们之间切换.这是我平时的做法,我只是偶尔使用分屏功能.
Or a less advanced use of screen
is just to open multiple full-screen windows and toggle between them. This is what I normally do, I only use the split screen feature occasionally.
GNU Screen Survival Guide 问题有很多很好的提示,如果您不熟悉的话及其使用.
The GNU Screen Survival Guide question has a number of good tips if you're unfamiliar with its use.
这篇关于如何在 Vim 中运行终端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!