Search code examples
vim

How do I run a terminal inside of Vim?


I am used to Emacs, but I am trying out Vim to see which one I like better.

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.


Solution

  • Updated answer (11 years later...):

    • I would recommend using tmux instead of screen 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.

    I would definitely recommend screen for something like this. Vim is a text editor, not a shell.

    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.

    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.

    The GNU Screen Survival Guide question has a number of good tips if you're unfamiliar with its use.