Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm aware I can do !commands but I'd like to somehow integrate a shell in vim. Or could I use screen and split the screen so that vim takes up say, half of the screen?

share|improve this question
up vote 9 down vote accepted

CtrlZ will suspend vim and return control to bash. Use fg to return to vim.

share|improve this answer

Integrating subprocesses is Vim's main weak point. There's no built-in support for a shell window, but you can try the vimsh plugin.

In Screen, press C-a c to create a new (full-screen) window. Press C-a p or C-a n to move to the previous/next window (C-a space also moves to the next window). Also the split command (C-a S) will split your screen into two regions; you can use one for a shell and one for Vim. Press C-a tab to switch between regions.

You can always press Ctrl+Z to suspend Vim and run commands in the parent shell; type fg to return to Vim. Or you can use :shell to create a (full-screen) subshell; type exit to return to Vim.

share|improve this answer

As you suggest, I would just use screen.

  • screen
  • ^A-c to create a new window
  • ^A-S to split the screen horizontally into two regions (some versions have Ctrl-| to split vertically)
  • ^A-Tab to move to the new region
  • ^A-n to change the region to the next window

If you don't want exactly half and half you can:

  • ^A-+ to increase the size of the current region

If you need to see what's in vim when you're on the command line, this is a good way to go. If you don't the Ctrl-Z/fg method already mentioned is the way to go.

share|improve this answer

You can also use :shell to just spawn a shell. Type exit or Ctrl+D to exit the shell and return to vim. If you want both running simultaneously, using fg/bg (per Ignacio), screen (as you suggested) or just two separate terminals (xterms, virtual consoles, whatever) are about your best options.

If you go to, you can probably find an extension which launches a shell directly, but you're getting dangerously close to emacs at that point. ;) Here's an example using screen:

share|improve this answer
"you can probably find an extension which launches a shell directly, but you're getting dangerously close to emacs at that point". Stop that talk, you're scaring the children. – TTM Nov 12 '10 at 23:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .