Is it possible in vim to create a split view for command line use?

11

4

I know about the option :!ls, but I would like to use one of the splitted interface ( after is used :sp) as a command line window. Is this possible? If it is, how do I do it?

p1100i

Posted 2012-10-08T15:36:13.953

Reputation: 700

vim8 has terminal mode built in.. see here: https://superuser.com/a/1312655/658319

– alpha_989 – 2018-04-10T15:29:33.177

3There are plugins and/or patches to accomplish that. But you will sooner or later experience some quirks. My suggestion is to use a full-featured lightweight terminal instead, or screen/tmux. – Marco – 2012-10-08T15:52:02.863

Answers

9

Unlike Emacs, Vim tries to be a bit more minimal when it comes to working with the shell. It does not have an option to include the interactive shell inside one of it's tabs or buffers.

Although there are workarounds for this. Just like you, I really like to have a bash window in the same terminal session as I have Vim running. It is super useful while editing source files. In my case I really like to have the Ruby REPL environment running so I can test out statements before I put them in the source files.

I use Tmux to accomplish the split window. In Tmux I create a split window (default key is ctrl+b, "). This will open 2 interactive shell sessions just like a split window in Vim. Then I run Vim in one of the sessions and I'm all set.

You can see from the picture below that I have split the window horizontally with bash on top and Vim on bottom.

enter image description here

I also use Tmux to support pair programming with others. You can read more about my setup on my blog at http://jjasonclark.com/Remote-Pairing-with-SSH-and-Tmux-on-a-Mac.

Jason

Posted 2012-10-08T15:36:13.953

Reputation: 280

7

Vim 8 has terminal mode built in.

You can type :ter to get access to the terminal.

To navigate through the commands in your default shell use j,k.

You can get more information by typing :h ter in VIM8.

Note: your VIM8 must have +terminal for this to work.

alpha_989

Posted 2012-10-08T15:36:13.953

Reputation: 623

7

Not sure if you were looking for a GNU screen solution, or a solution using Vim's built-in splits, but if you're looking for the latter, this worked for me:

vim -O file_a.js file_b.js

That a opens both files with a vertical split. For a regular (horizontal split), just use a lower case -o instead.

P.S. Ctrl+w, w to switch between the two (I find it a good way to differentiate screen splits and vim splits).

J.M. Janzen

Posted 2012-10-08T15:36:13.953

Reputation: 216

5Though this doesn't answer the original question, this answer did answer my google search query that got me here. :) – Mihai Alexandru Bîrsan – 2017-06-26T18:53:38.303

Ditto - thanks! – CaseyR – 2020-01-07T13:03:17.233

6

Have you tried screen? Any reason that wouldn't work out for you?

Alex Nye

Posted 2012-10-08T15:36:13.953

Reputation: 832

3

I was looking for this for long and as much as I can say nothing good is really possible. I have tried many plugins/addons for vim but no one worked as I wanted.

This one is good though: ConqueTerm

However it has some inconsistency with colors. Give it a try maybe it works out for you.

rowman

Posted 2012-10-08T15:36:13.953

Reputation: 335

Check this one as well: https://www.youtube.com/watch?v=5__I_cnxmPc&feature=related

– rowman – 2012-10-08T21:19:41.220

1

You can use NeoVim, it has a built in terminal mode similar to emacs (although very new) - this lets you have it in a window like any other vim buffer

alcesleo

Posted 2012-10-08T15:36:13.953

Reputation: 11