14

Possible Duplicate:
How to run a terminal inside of vim?

I can setup my workspace nicely with split and vsplit and open... but I would like to simply use one of the splits as a terminal window. I know opening an additional xterm and placing it strategically might be able to accomplish this but many times I am telneted into a single window and my hands are beginning to hurt from alt tabbing between terminals.

Update: The best thing I came up with based on the suggestions below was to use screen and actually have vim occupy one of its windows.

Community
  • 1
  • 1
ojblass
  • 21,146
  • 22
  • 83
  • 132
  • I think you ought to try out ConqueTerm. https://github.com/rson/vim-conque Screen's great but ConqueTerm is really well implemented. (in my opinion) – Calvin Cheng Aug 26 '11 at 17:29

7 Answers7

14

I use : http://code.google.com/p/conque/wiki/Usage

You can type :split new and the :ConqueTerm bash. And you have a working terminal window. :)

Claudiu
  • 141
  • 1
  • 4
  • This was the exactly solution I was finally happy with. I tried the screen solution, the vimshell solution; but my final personal preference is ConqueTerm. – Calvin Cheng Aug 26 '11 at 17:27
13

Consider running Vim and a shell together in GNU Screen. The Vim wiki has info on integrating Vim and Screen. Screen supports splitting into "windows" similar to Vim's. See here for an example of even tighter Vim+Screen integration.

Having a Vim buffer tied directly to an external interactive commandline app is a feature that many have wanted for a long time, but apparently it's a bit difficult to do, due to how Vim is implemented, and the Vim devs are reluctant to change this (for arguably good reasons).

But there have been a few success stories. The Lisp community in particular has tried to reproduce Emacs' SLIME (an interactive Lisp prompt) in Vim. See VimClojure and Limp for examples. One of those could probably be altered to run a shell, but it'd take some work.

Brian Carper
  • 71,150
  • 28
  • 166
  • 168
8

The vimshell patch sounds like what you're looking for.

Michael
  • 4,700
  • 9
  • 35
  • 42
3

If you're in vim, you can exit to a sub-shell with the ":sh" command, and then get back to vim with "exit". Or you can just suspend vim and go back to the original shell you started it from with control-Z, then go back to vim with "fg" (foreground).

Or there is an "vim-shell" add-on you can install.

Paul Tomblin
  • 179,021
  • 58
  • 319
  • 408
2

Expanding on Brian Carper's answer, you could throw this into your ~/.screenrc:

startup_message off
# Launch 2 screens on startup
split
# Have bash login so $PATH will be updated
screen -t Vim bash -l -c 'vim' 0
focus
screen -t canvas bash -l
# switch focus back to vim
focus up

Then when you type screen, you'll have a Vim window on top and a bash window on the bottom. You can switch between screen windows with <C-a><Tab>.

Community
  • 1
  • 1
jmdeldin
  • 5,354
  • 1
  • 28
  • 21
2

conque shell for vim does this too.

enter image description here

http://www.vim.org/scripts/script.php?script_id=2771

http://code.google.com/p/conque/

dkinzer
  • 32,179
  • 12
  • 66
  • 85
  • 1
    This is useful! One thing that I don't know how to do (looking at your screenshot you're doing it but with Python instead of Ruby) is that I want to run my test suite using an existing utility when I save a file. It works, but if I'm not in INSERT MODE in that window, it won't write the STDOUT of the utility to the buffer so I have to go in to that window every time and hit `i` to see what specs failed. Do you know of a way to get the window to always write out the utility's STDOUT to the buffer even when not in INSERT MODE? Cheers! – Michael van Rooijen Jan 20 '12 at 17:06
  • 1
    I just found `let g:ConqueTerm_ReadUnfocused = 1` which does just that. Unfortunately it says that due to certain scripting limitations with VIM, it won't allow for scrolling with the Window in a non-focussed state. Too bad. :/ – Michael van Rooijen Jan 20 '12 at 17:53
-3

You will have to forgo this I'm afraid - no way to do it in vim.