Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

leave vim split window in insert mode

Tags:

bash

vim

I want to view the output of a bash command in a vim split window :split. To this end I installed "Conque Shell" which displays bash in a split window upon :ConqueTermSplit bash. I can then run my shell command and watch the output in insert mode. However, to return to the other window I need to type <CTRL-W> <Up> in command mode, so I need to leave insert mode. Hence the display of the command output freezes and continues only if I return to this window and enter insert mode. So how can I leave "Conque Shell" without leaving insert mode.

Note that other ways of viewing the bash output in a second window might solve my problem as well. However it should update while I am working in the other window and allow me to signal e.g. <CTRL-C> to the application.


The ConqueTerm documentation says:

3.1.5 Keep updating terminal buffer *ConqueTerm_ReadUnfocused*

If set to 1 then your Conque buffers will continue to update after you've switched to another buffer.

Note: Conque buffers may continue to update, but they will not scroll down as new lines are added beyond the bottom of the visible buffer area. This is a limitation of the Vim scripting language for which I haven't found a workaround. > let g:ConqueTerm_ReadUnfocused = 1

like image 263
rembremading Avatar asked Aug 10 '11 22:08

rembremading


People also ask

How do I exit insert mode in Vim?

To exit from 'insert' mode, hit ESC (the escape key). If you want to force a quit (i.e. quit without saving) type: :q!

How do I switch between split windows in Vim?

To move between splits first press Ctrl-w (I remember this by Control Window, I'm not sure what the official mnemonic is) Then press a directional key to move the cursor to the split you're interested in. Directional key could be the arrows or my preferred home row method.

How do I start Vim in insert mode?

Open a new or existing file with vim filename . Type i to switch into insert mode so that you can start editing the file. Enter or modify the text with your file. Once you're done, press the escape key Esc to get out of insert mode and back to command mode.


1 Answers

AFAIK Vim has no support for asynchronous sessions, so this is more of a response to your request for potential alternative options.

The way that I currently get around this issue is by using tmux, which is described as:

a terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen.

So, basically, instead of splitting your screen in Vim you would split it using tmux, and then in one window run Vim and in the other run whatever other program you want which will update completely independently of Vim. And just like Vim you can switch between the windows (or panes as they are called in tmux lingo) using a couple of key strokes.

There is another terminal multiplexer available called GNU screen, which is also quite popular. And the reason I mention that is because I like to have options, and also there are two plugins for Vim that allow you to send output directly to an attached screen or tmux session. For GNU screen, slime.vim, and for tmux, tslime.vim.

like image 63
J.C. Yamokoski Avatar answered Oct 16 '22 00:10

J.C. Yamokoski