If, at a command prompt, I run
vimdiff file1 file2
I get a vim instance that has two files open side-by-side, something like this:
╔═══════╤═══════╗ ║ │ ║ ║ │ ║ ║ file1 │ file2 ║ ║ │ ║ ║ │ ║ ╚═══════╧═══════╝
This is very nice, but sometimes I want to open a third file to look at. I don't want to create another vertical split, because otherwise the lines will be so short I'd be scrolling horizontally all the time just to read them. But occupying a few lines at the bottom of the screen wouldn't hurt. So, how can I go from the above to the following:
╔═══════╤═══════╗ ║ │ ║ ║ file1 │ file2 ║ ║ │ ║ ╟───────┴───────╢ ║ file3 ║ ╚═══════════════╝
I've tried using
:sp file3, but I just end up with this (supposing I ran the command while the cursor was in file1):
╔═══════╤═══════╗ ║ file3 │ ║ ║ │ ║ ╟───────┤ file2 ║ ║ file1 │ ║ ║ │ ║ ╚═══════╧═══════╝
Thanks in advance for your help!
vim mapping :w with a shell command
Is it possible to display Indentation guides in Vim?
Delay before 'O' opens a new line?
and open a new file inside..
Map key to toggle between normal mode and insert mode in Vim
Does omnicppcomplete support typedef syntax
How do I get the VIM matchit plugin working with ColdFusion and HTML?
How to delete bookmarks in NERDTree (Vim)?
:sp file3as in your last example
^WJwill move an existing window where you want it to go..
how to map keys for popup menu in vim
But to avoid having to type all that, you can create a "User defined command" like this:.
:bot split +edit thirdfile.cpp
Now you can just type
:command -complete=file -nargs=* Third bot split +edit <args>
:Thirdto create the third window at the bottom of the screen with the file you want to edit, for example:.
Notice that you can auto complete just like with a normal
:edit.. And of course you can change the name of the command to something else if you don't like
:Third, just keep in mind that it must start with a capital letter.. For more info type