Questions tagged [split]
Questions about splitting current window into multiple viewports.
181
questions
228
votes
6
answers
160k
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?
127
votes
4
answers
183k
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 ...
81
votes
1
answer
36k
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
80
votes
7
answers
45k
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 ...
59
votes
2
answers
18k
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 ...
45
votes
2
answers
22k
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?
42
votes
4
answers
28k
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 ...
39
votes
6
answers
7k
views
How to undo/revert making current window the only window (":only" / "<C-W> o")?
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&...
36
votes
3
answers
22k
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 ...
30
votes
1
answer
7k
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 ...
28
votes
3
answers
15k
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 ...
28
votes
2
answers
8k
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 ...
28
votes
2
answers
10k
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?
20
votes
2
answers
7k
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 ...
19
votes
4
answers
6k
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 ...
17
votes
1
answer
1k
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
14
votes
1
answer
2k
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 ...
13
votes
3
answers
7k
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?
13
votes
1
answer
3k
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, ...
13
votes
2
answers
1k
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??
__________________________
| | |
| |...
11
votes
2
answers
2k
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&...
11
votes
2
answers
3k
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 ...
9
votes
3
answers
3k
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 ...
9
votes
1
answer
3k
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
...
9
votes
1
answer
199
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
0
answers
645
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 ...
8
votes
5
answers
3k
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 ...
8
votes
3
answers
13k
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 ...
7
votes
1
answer
4k
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?
...
7
votes
4
answers
1k
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 ...
7
votes
1
answer
2k
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?
7
votes
1
answer
1k
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
2
answers
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
1
answer
6k
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 ...
6
votes
2
answers
5k
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 ...
6
votes
2
answers
107
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 ...
6
votes
2
answers
2k
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 ...
6
votes
0
answers
97
views
Filetype changes when using :split and :Explore
Why does using :split and :Explore cause the filetype to change?
For example, edit a file named text.man, and the filetype is set to man. Change the filetype to txt, then :split and :Explore in the ...
5
votes
3
answers
9k
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
2
answers
684
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 | ...
5
votes
2
answers
2k
views
Carets in status line
When splitting the editor window, the caret symbols appear in the status line of the current window.
This happens when StatusLine and StatusLineNC have the same highlighting. For example, when
cterm=...
5
votes
1
answer
918
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
1
answer
2k
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
2
answers
1k
views
How could I maintain split layout when deleting buffers?
I opened 5 buffers and in one of them I use the command :vs to split the current buffer screen into two.
When I use the command <leader>d to close one of the splitted buffers, the consequence is ...
5
votes
1
answer
3k
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 ...
5
votes
1
answer
741
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
1
answer
169
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 ...
5
votes
2
answers
979
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 tries ...
5
votes
0
answers
137
views
Intermittently cannot switch from Vim terminal to other panes
I've looked at quite a few other posts and haven't found a similar problem. I've recently begun using WSL and Vim and love it. Most of the time, it works great and I use CTRL-W-h/j/k/l to navigate ...
4
votes
1
answer
9k
views
How to do :Sex but with a vertical split?
When viewing a file /tmp/vim_split_demo/test.txt, the parent directory can be opened in a horizontal split screen using the command :Sex, as shown in these screenshots:
What command gives same ...