Questions tagged [split]

Questions about splitting current window into multiple viewports.

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

Resizing split panes in vim with {n}Ctrl-W +/- not working as described on MacOS

I am using vim on MacOS. I have one vertical split down the middle and two panes split horizontally on the left side ( :Vex Ctrl wh :Sex ). From my understanding nCtrl w +|- should resize the focused ...
3 votes
1 answer
48 views

How can I run an autocmd before (!) a window is split?

TL;DR: I want to avoid split windows and tabs. Is there a way to intercept a split command with an autocommand that translates every window split, including those of plugins, into a simple buffer ...
0 votes
2 answers
95 views

QuickFix window default postion

It seems that the QuickFix window is created on the bottom of the upmost right vertical split. If I start with two splits: When I open the QuickFix window (:copen) the QuickFix windows is created as ...
0 votes
1 answer
85 views

Vim vertical split window not rendered correctly

Not sure if it's related to vim configuration, tmux settings or ssh config, I opened a file with vim on a remote server, and every time when I use :vsp command to split a vertical window, the right ...
0 votes
2 answers
43 views

How to convert a string into a list of matching and non-matching substrings?

I have a list that I'm trying to filter. I'm planning to separate a string into parts of the string that matches a pattern and parts that doesn't. Like if the string is: <h1>hello</h1> ...
0 votes
1 answer
41 views

Vim - open wrong path when I run command ':vs .' run in Vim

When I run the :vs . command in Vim for the current working directory window split, the parent directory opens, not the current directory. Example: A/B/C$ vi test.c in Vim: :vs . Split window ...
0 votes
2 answers
132 views

netrw :Sex and :Vex clear the current buffer

If I open a file in Vim and then run :Vex (or :Sex) it opens netrw in both the new split and the existing split. This happens even if I have unsaved changes, meaning the changes are lost. The ...
0 votes
0 answers
29 views

Why does `Ex` apply to both splits? [duplicate]

I noticed that when I split multiple times in combination with Ex, for example I run the following commands :Sexplore :q :Sexplore It will open netrw in both splits. I expected it to only open in the ...
1 vote
3 answers
123 views

How to Directly Go to Editor Groups?

Currently, I'm using C-wC-h-type of shortcuts to navigate through open editors. However, in VS Code, I'm also used to using shortcuts like C-1 to go to the first editor group, instead of hopping ...
0 votes
1 answer
19 views

Starting from three horizontally split windows in Vim, how to have a new window vertically split to the left of all three initial windows?

Let's say we have three windows split horizontally in Vim and we want to have a new window that is split vertically to the left of all three current windows. How can this be achieved?
0 votes
2 answers
55 views

How to open files from terminal in desired pattern (tabs, vertical and horizontal splits on desired files)

So, I wrote next bash script: #!/bin/bash if [ "$#" -gt 1 ]; then path=$1 else path=$(cat subject.txt | tr -d '\n') fi nvim -p 1 "setup/$path/body.tex" -p 1 preamble/...
1 vote
2 answers
74 views

Open the same file in two vertical splits: one editable, the other not

I need to refactor some paragraphs from an article. I would like to have: One split with the original version (not editable) Another split with the document to edit Is it possible?
2 votes
1 answer
2k views

Splitting windows

Is there any way I can split the window as illustrated in the image?
4 votes
4 answers
2k views

How to split view multiple buffers in vim

Working with big projects, I often find myself needing to view/edit several files at once. If I have multiple buffers open, is there a way to split the window to view multiple files in one command? E....
0 votes
1 answer
34 views

vert command works but v doesn't

To open a buffer in a vertical split, you can use the word "vert". For example : :vert term #it opens a terminal in a vertical split :vert sb1 #it opens the buffer 1 in a vertical split ...
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&...
0 votes
2 answers
294 views

Is there a way to switch files in split screen?

I've been reading a lot about split screens in vim, but actually getting your cursor over to the other document is still a problem. You can create a vertical split screen with :vsplit <file-name>...
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 ...
-1 votes
1 answer
89 views

Edit a file in two different terminal windows

It's nice to edit the same file from two different views. I use a vsplit for this, as described here, and it works well. However, I'd like to have the two views open in different terminal windows, ...
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 ...
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 ...
3 votes
1 answer
545 views

Switch between splitted file with SPACE + NUMBER instead of CTRL-W (like in spacevim)

Right now, when I split a file in VIM, I need to use CTRL-W + h/j/k/l to switch between them. In spacevim (https://spacevim.org/), each file has a number visible in the bar (see picture), and I can ...
0 votes
1 answer
815 views

Splits on different monitors

I'd like to edit the same file at two different locations, let's say at the beginning and at the end of the file. Splits (:sp) are a natural way to do this. I have two monitors available and it sure ...
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 ...
4 votes
4 answers
7k views

Open another file in split view that sits within the same directory as the currently opened file

I know there's a file called handler.ts in the same directory as the currently opened file handler.test.ts. How do I open that file in a split window (horizontal or vertical) without doing this: Ctrl+...
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 ...
1 vote
1 answer
279 views

Showing text info in window split separators

(I'm using nvim 0.7 and have recently moved from a init.vim to lua, which is baffling me slightly.) In my old set-up a split would look like this: → note that the bar that splits the two windows ...
0 votes
2 answers
125 views

Adapt side panels to different screen resolution (aspect ratio)

How can I adopt side panel plugins (TagBar, TagList, NerdTree, etc) width to current screen aspect ratio? Using Vim with many different computers makes me a bit trouble to write one portable config ...
1 vote
0 answers
90 views

Neovim 'tab' or 'vert' no longer splits, just creates buffer

When I start a neovim session, my first command is to startup a terminal session within vim. However lately (perhaps due to an OSX update?) any use of vert or tab no longer performs a vertical split, ...
4 votes
4 answers
2k views

Execute external command in split window

Is there a way to get the following in Vim: If I execute a command in Vim like !make c, I would like to have a frame/split that pops up like in syntastic instead of switching to terminal view. That ...
1 vote
0 answers
141 views

How to split view all buffers in vim with equal distribution vertical horizontal

How can I split view all buffers in vim with a distribution between vertical and horizontal? Is there a plugin? I know how to make all buffers appear in either horizontal or vertical splits: :ball :...
1 vote
2 answers
30 views

Make vim splits always positioned in the same place

Lets say there are multiple splits at the following layout. Is it possible to keep the last two placed in their position when the editing area is closed or unloaded from the buffer list, and fill its ...
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 ...
0 votes
0 answers
27 views

Is it possible to fix a section of buffer fixed on top even when scrolling?

I need to open 4 different files on my screen to consolidate data on diff file . I kept forgetting which tile is which file.. All my files has file name on line 1.. Is there way to keep the line 1 ...
0 votes
1 answer
49 views

How to change [esc] behavior only in normal mode?

I'm hoping I phrased the question correctly as I'm not too sure how to ask my question. When I work in vim I use multiple "splits" (eg. :vsp, :sp). To navigate through the splits I have it ...
2 votes
1 answer
42 views

Set split to size of file

I have a file that is 9 lines long called foo.txt . I use :split foo.txt and the new split takes up a full 50% of the editor, which results in a lot of wasted space. I can resize it with :resize ...
2 votes
1 answer
41 views

Vim seamless file split with same features over the split windows

I have been searching for a way to do the following but haven't found exactly what I need, not sure if it's possible. I want to be able to split a file, but have the same features over the two splits ...
1 vote
1 answer
258 views

How to properly set up ftplugin files for working with different filetypes in different windows?

$ vim --version VIM - Vi IMproved 8.1 I set up the following vim configuration files: " .vim/ftplugin/text.vim set textwidth = 0 " .vim/ftplugin/python.vim set textwidth = 99 set ...
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=...
0 votes
0 answers
27 views

After opening all args with :ba, go back to a single split

Generally when opening more than two or three files in vim, I use a single split, navigating between the files/buffers with :n/:N. Sometimes, however, I want to open all of them in visible splits at ...
2 votes
2 answers
542 views

Make the default behavior of split window resize consistent

I use the keybinding Ctrl+W >/< to increase/decrease width of the split window, and that works just fine when the split window is in the left. However when I switch to any split beside the one ...
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?
1 vote
1 answer
264 views

Split and switch to bottom window when opening vim

When I open a file of a given filetype I want it to split into two windows with the cursor in the bottom window. I can get this to work when opening the file from an existing vim session. But when I ...
0 votes
0 answers
118 views

Why does my syntax highlighting disappear after so many splits?

I can successfully run :sp *filename* several times per vim session, but after a seemingly-random number of splits (5-10) all future splits will no longer have syntax highlighting until I fully quit ...
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 ...
1 vote
1 answer
979 views

How to disable scrollbind and cursorbind after using vimdiff?

I have this issue where I need to both compare files, which I do using vimdiff, but also work on individual files with vertically split screens (vs). However, after I call vimdiff on a file, opening ...
1 vote
1 answer
91 views

How can I make Packer ignore the splitright setting?

I have splitright set in my init.lua so that when I run :vs, the new split opens on the right. Using Neovim 0.5-HEAD, Packer follows this setting and opens its splits on the right. I would like these ...
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 ...
1 vote
1 answer
557 views

navigate between current and previous tab or split

Is it possible to navigate between two previously used tabs and/or splits? I understand why buffers are best to use, and that I can use :b# to achieve what I want, but I have wondered if this was ...
2 votes
1 answer
2k views

How do I change focus in vim split through the command mode?

I am writing a function which splits open vim in three parts but the focus shifts towards the newly opened window and I don't want that that to happen is there any way to stop this? or is there a ...