Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I have vim and a console in the same window? For example, I am splitting up the vim window into multiple windows (vertically or horizontally). What I want is to have the code window on the left side, and the interpreter or console or whatever on the right side, so I can easily switch between them. How does that work? Is there something there for this?

share|improve this question

7 Answers 7

up vote 11 down vote accepted

You probably are looking for GNU Screen.

From this tutorial

Splitting the screen in half horizontally

Screen has the ability to split the window into two or more half horizontal windows. This feature will enable you, for example, to work in a half screen, while viewing the system resources ("top") in the remaining half.

To split the screen in two, first create two screen sessions. Then press Ctrl+a S which will split the screen in half, giving you a session on the top that you're already using and a blank session at the bottom.

To move to the bottom half, press Ctrl+a, then the TAB key.

share|improve this answer
1  
This is the most powerful of them all, as you can do n-way splits of any console application in both horizontal and vertical panes. –  Mies Nov 21 '09 at 0:43
1  
Oh yeah, for a vertical split, press Ctrl+a | . It follows the same behavior at horizontal splits. –  Mies Nov 21 '09 at 0:45
    
Thanks, this is exactly what I wanted. –  hyperboreean Nov 21 '09 at 1:50
    
Is there a way to actually tell to screen to resize it 70-30 or 60-40% ? –  hyperboreean Nov 21 '09 at 1:54
2  
You can press Ctrl+a, then :, then type resize N or resize +N where N is the number of lines you want the height to be or +N is the number of lines you want to add to the current height (or -N to decrease). –  Dennis Williamson Nov 21 '09 at 3:07

Don't forget the vim quickfix commands for the edit-compile cycle (see :help quickfix and :help make).

Maybe it's a radical suggestion but consider using a tiling window manager. In the following screenshot you can see vim in the left column, with the quickfix window opened, and on the right an xterm used to launch and test the application. The window manager used is called wmii.

alt text

share|improve this answer
    
+1 for wmii, best... window manager... ever :). It's like being on the command line with windows. –  chmeee Apr 15 '10 at 12:33

You can also try tmux , which is an alternative to GNU screen and is actively developed. You can set screen like shortcuts and have a nice configurable status bar.

share|improve this answer
    
Check the nice configurable status bar with tmux powerline –  Atropo Nov 30 '12 at 8:07

You can use the VIM-Shell patch. This way, you don't have to remember to create a screen session for Vim before editing.

share|improve this answer
    
Instead you just have to remember to patch Vim... –  womble Nov 21 '09 at 0:47
    
Yes, but one usually edit files more often than compiling Vim. –  Mikael S Nov 21 '09 at 1:10
    
Or just reflexively run everything in screen -- it's how I work now. If I'm not in a screen session, it is highly unusual. –  David Mackintosh Nov 21 '09 at 1:29

If you don't use vim-specific features (but rather use only vi-compatible commands), you might try vile, a vi clone with intelligent multiple buffer handling, more similar to emacs.

This also has the advantage of allowing you to use your editor inside a screen session without removing your use of any other screen windows.

share|improve this answer

You could try the Conque Shell plugin. Haven't tried this yet myself but it's got a high (1:3) rating-to-download ratio, and claims to do just what you want. The actual rating is pretty decent, especially since it's only been around since 2009-09, and only hit version 1.0 in February. The advantage of using this over the VIM-Shell patch is that you don't have to patch vim; you just install the plugin in your ~/.vim directory.

share|improve this answer

You may also be interested in trying the Dynamic Virtual Terminal Manager. It does something similar to the screen features highlighted in a previous answer, but is in my opinion easier to work with. Here are some of the default keybindings:

Ctrl+G C        Create a new shell window
Ctrl+G X        Close focused window

Ctrl+G J        Focus next window
Ctrl+G K        Focus previous window

Ctrl+G G        Organize windows in a grid layout
Ctrl+G T        Organize windows in a vertical stack tiling layout
Ctrl+G B        Organize windows in a horisontal stack tiling layout

Ctrl+G M        Maximize current window (display one window at the time)
Ctrl+G .        Minimize current window (show only window title)

DVTM also supports mouse integration; simply click on a terminal window in order to select it. Screenshots are available at the website linked above.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.