Questions tagged [split]

Questions about splitting current window into multiple viewports.

Filter by
Sorted by
Tagged with
155
votes
6answers
86k views

How do I change the current split's width and height?

I am working on split (using ^w+v, ^w+s) buffers, but sometimes I would like to widen a current split or change its height. How can I achieve that?
96
votes
4answers
123k views

Is it possible to split Vim window to view multiple files at once?

When working with multiple files, it would be very handy if we can see more than one file in the screen at once. Is there any way in Vim to split the window (horizontally or vertically) so each split ...
58
votes
1answer
20k views

How to open multiple files in split mode?

I know how to split windows in vim, but it's possible to open multiple files using vim in split mode (at startup) from the command line? In example: vim file1 file2 file3 or: vim *.cpp
50
votes
6answers
22k views

Swap the position of two windows

Say the following is the current structure of my window: +-----+---------------------------- | | | A | | | +-----+ | | | B | The order of A and B is not quite natural. It would be ...
40
votes
2answers
11k views

Close all split files, except the one currently focused?

Sometimes when I'm working on a file, I'll open up multiple files just to get an idea of the current flow of the code up to a point. However this sometimes leads to multiple files being open at a time ...
32
votes
2answers
13k views

Can I open a new vim split from an existing buffer?

I know it's possible to open a new file in a split, with :split or :vsplit, but is it possible to open a new split with an existing buffer, potentially leveraging autocomplete?
30
votes
4answers
15k views

How can I work with splits in Vim without Ctrl-W?

My terminal doesn't allow me to type Ctrl+W, because that's a shortcut for closing a terminal tab. I like working with splits, but I can't find any way to do so without using C-W. This forced me to ...
30
votes
3answers
10k views

In Vimdiff, how do I switch the left and right panes?

When I do vimdiff file2 file1, file2 naturally goes on the left and file1 on the right. Sometimes I find that I put them the wrong way round, so I'd like to be able to switch them round without ...
28
votes
5answers
5k views

Undo Only Window

Consider a case with multiple splits in a window. vim allows quickly "maximizing" the current split to take up the whole window via <C-W> o. Is there a way get vim to "remember" the splits ...
25
votes
3answers
11k views

Can the split separator in vim be less than a full column wide?

I use a tiling window manager (awesome) + a terminal multiplexer (tmux) + splits inside of vim. I have no window decorations at all, so there is no visual split between them at all if the content of ...
24
votes
1answer
3k views

How can I get both splits to scroll left or right at the same time?

I want to open up two different parts of a document in horizontal splits (using :sp) and scroll both of them left and right together. For vertical scrolling, you would use scrollbind. However, I'm not ...
20
votes
2answers
6k views

Make panes resize when host window is resized

I like to use vimdiff as a git diff/merge tool. The problem is when I resize the host terminal window to a new size: of the two split panes, the leftmost remain of the same width, while the rightmost ...
20
votes
2answers
4k views

How do I open a new buffer without opening it in a split?

I know I can use :new to open a new buffer in a split window (defined by set splitbelow and set splitright). But how can I just open a new, empty buffer without opening it in a split?
18
votes
4answers
5k views

Send text from one split window to another

Recently there was an add-on to NeoVim which allows opening terminal in a vim buffer. This has appealing possibilities to send text from one vim window to another replicating, for example, a REPL like ...
16
votes
2answers
2k views

How to exit vim from split mode?

How to efficiently exit vim when editing multiple files in the split mode at one go? It seems when I'm having e.g. 10 split windows, I've to repeat 10 times :q! command for each window which is a bit ...
13
votes
1answer
888 views

What is the difference between a tab, viewport, window, split and buffer?

What is the difference between the following in vim: buffer window viewport split tab
13
votes
2answers
824 views

Is it possible to tell if a window is at bottom or top, left or right?

I don't know if there's some function to check a window's position, I mean is it currently sitting at bottom or top, left or right?? __________________________ | | | | |...
12
votes
3answers
6k views

Is it possible to have the output of a :! command in a split rather than the whole window?

If I have a vim session with two splits, when I execute a :! command, the result is shown in the entire window. Is it possible to have the output shown just on the active split?
11
votes
1answer
2k views

How should the option 'switchbuf' work?

I recently discovered the option switchbuf and tried to use it but I can't say if I don't understand how it should work or if it actually doesn't work on my Vim. About the different possible values, ...
9
votes
1answer
142 views

Can I force parentheses matching to show up across multiple windows?

I have a source file containing a long list of deeply nested heterogenous structures. Since the structures are long, I would like to: Use the :split command to split the screen into two. Scroll down ...
9
votes
0answers
400 views

Vi and Vim default to split left and split above. What is the history and motivation behind this?

When a window is split, given that Vi/Vim splits are not stored in a tree structure, the "direction of the split" is basically "the window in which the cursor is placed after the command". Update ...
8
votes
1answer
2k views

How can I move windows from a vertical split to a horizontal split?

I have three vertically split windows. I want the leftmost window to remain as it is, but move the two other windows from a vertical to a horizontal split. How can I achieve this? I want to get from ...
8
votes
0answers
445 views

Persistently fix the height of a split in vim

So I searched the web far and wide and I can not for the life of me figure out how to do this. I have the following key binding: nnoremap <leader>o :below 10sp term://.//$SHELL <cr> :set ...
7
votes
1answer
2k views

Vertical equivalent of “control+w n”?

I often want a new empty vertical pane (vim window / viewport ...) in my current Vim tab. I know I can get a new empty horizontal pane by doing control+w n. I know I can split the current pane into ...
7
votes
4answers
591 views

What workflow to use when editing large multifile projects

Lately I've been shifting more nad more of my work from IntelliJ to vim. With a handful of plugins and setting tweaks, I don't miss the IDE much. One thing I do miss is the ease of navigating a large ...
6
votes
2answers
2k views

Duplicate tab with windows

I have opened several files in vim (particularly, in vimdiff). They are opened in multiple (vertically split) windows. Is there a simple way, in which I can duplicate all this to another tab? I ...
6
votes
1answer
934 views

How to lock a window height / width?

I jot notes in a tiny split window (buffer) regularly: <C-W>s :enew :res 5 ... jot jot... When I create a new horizontal split in the same tab, that little window resizes, as if doing <C-W&...
6
votes
1answer
1k views

How to change the location of a new vertical split?

The question is somewhat straightforward. To open a vertical split, I use: :vs. When opening a vertical split, I'd like to initialize it with a file directly. If I do :vs myfile.txt this will move ...
6
votes
1answer
650 views

Hide statusline when more than two windows open without suffering the extra hidden empty line artifact?

I want to hide the statusline, I don't ever use nor care about what is written in it. The problem is vim doesn't offer a way to achieve that in a convenient manner. If I just do set laststatus=0 I ...
6
votes
2answers
1k views

If I split the screen and open a Netrw dir listing in one window, Vim won't let me focus that window

I'm using Vim 7.4. I have a buffer open and I type :vsplit. Vim splits the screen and I see my buffer in both windows. That's great. Just what I want. And at this point ctrl+W W switches the focus ...
5
votes
3answers
2k views

How to open a file from active buffer into a split window?

I have some files in my vim buffer. :ls shows the list of active buffer, I want to open a file from buffer into a vertically/horizontally split window. I know :vsp or :sp open split window in vim ...
5
votes
3answers
6k views

How to stop gVim wrapping text at column 80

I have a README.txt file as follows: This document is a list of a) Known issues in the services or test environment, i.e. things expected to fail b) Things to be improved in the test suite c) ...
5
votes
1answer
766 views

Spread already open files into split view

Suppose I open multiple files in vim like this: vim a.cc b.cc x.cc vim will open all files, but show only one at a time, the rest being accessible using the :next command. After having these files ...
5
votes
1answer
2k views

Is it possible to obtain the displayable area, width and height of current buffer in Vim?

I know Vim provides functions to display window's dimensions. But does it also provide ways for me to know current buffer/split's dimensions? Like how many lines and columns in displable area? ...
5
votes
1answer
3k views

Working with error lists while compiling

When I try to get a program to compile, I use the following process: :sh to open a shell make scroll up to see the compilation errors exit to get back to vim fix errors that I remember (usually 2 or ...
5
votes
3answers
7k views

how to use Netrw Directory Listing in VIM split window without exiting it when a file has been read

When using VIM, it is possible to get a file listing in one split window by doing this: :vsp :e. Then you have something that looks like this: However if you open a file then how can you get back ...
5
votes
1answer
915 views

How to auto save file when moving between split?

I'd like to automatically save buffer after moving into another split. If you're interested why I'm interested in that read section below. I've started using vim and then neovim not so long ago, so ...
5
votes
1answer
443 views

Vim split overflow

On some files, a line (often the status line) overflows straight onto the next line, which screws up rendering until the size changes (when I close/resize a vertical split etc). This also happens ...
5
votes
2answers
3k views

Can I move my current tab to a split in a different tab?

This happens to me semi-frequently. I have two tabs open, and I would like to merge them into one tab with a vertical split. Essentially, I want to do the opposite of CTRL-w_T. Right now, I have to ...
5
votes
2answers
733 views

How to prevent Vim from scrolling buffers when I open split

When I open a new split Vim is scrolling both buffers up despite having enough space. Here is an asciicast This behaviour comes out-of-the box in vim -u NONE. It is really annoying. My guess it ...
4
votes
2answers
146 views

Open multiple files in custom split layout

I want to open three files file1.txt file2.txt file3.txt in vertical and horizontal split combination, like this: +-------------------------------+ | | | | file1.txt | ...
4
votes
4answers
416 views

How to open files in vertical splits by default?

Is there a way to make vim (or nvim) open all new splits vertically by default? There's splitright to control which side vertical splits open on, but as far as I can tell there's no built in option to ...
4
votes
3answers
85 views

Can I :split and go directly to a line?

I can open a file with vim on the command line like so: vim fnord.txt +50 And it will take me to the 50th line Is it possible to do the same thing with :split? So far I haven't been able to figure ...
4
votes
1answer
740 views

Open ctrl+] in a new split?

How can I open the result of ctrl+] in a new split? similar: How do I open a tag with ctrl+] but open it in an existing split?
4
votes
1answer
894 views

Having issues maping <C-j> and <C-h> in vim [duplicate]

I tried to remap my split navigation like explained here. Moving to the top or right split works but ther other two just do nothing. I tried the same without a .vimrc which led to the same result. ...
4
votes
1answer
58 views

Position command line under current window?

Sometimes I work with a vertically split window and I was thinking it would be cool if when I enter the command line with :, /, etc., the command I type would appear below the current window instead ...
4
votes
1answer
73 views

Why are there no rightabove / leftbelow commands?

Referring to the existing leftabove and rightbelow commands, which do the following: execute a command if the command results in a split, it will be either opened on the left, or above the current ...
4
votes
2answers
186 views

From one split, how can I get the filename of the file in another split?

I have two files open, each one is in a split. From file one, how can I get the filename of the file in split two ? In command mode, I can get the reference of the filename I'm currently editing by ...
4
votes
1answer
64 views

Pipe native command to vsplit

I have opened vim in a directory of code which contains long_name_module.py. My path variable is path+=** so the python file is visible to find. I type :find lo<tab> and the filename is ...
4
votes
1answer
813 views

A fixed position for preview windows

Is it possible to setup vim to open all preview windows on a specific location. I want them to open on the right side.