6

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?

7 Answers 7

11

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.

4
  • 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, 2009 at 0:43
  • 1
    Oh yeah, for a vertical split, press Ctrl+a | . It follows the same behavior at horizontal splits.
    – Mies
    Nov 21, 2009 at 0:45
  • Is there a way to actually tell to screen to resize it 70-30 or 60-40% ? Nov 21, 2009 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). Nov 21, 2009 at 3:07
2

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

1
  • +1 for wmii, best... window manager... ever :). It's like being on the command line with windows.
    – chmeee
    Apr 15, 2010 at 12:33
2

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.

1
1

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

3
  • Instead you just have to remember to patch Vim...
    – womble
    Nov 21, 2009 at 0:47
  • Yes, but one usually edit files more often than compiling Vim.
    – Mikael S
    Nov 21, 2009 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. Nov 21, 2009 at 1:29
0

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.

0

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.

0

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.

You must log in to answer this question.

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