Questions tagged [split]

Questions about splitting current window into multiple viewports.

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

How to open a command in a split window?

I'm using grep in vim to do something such as: :grep pattern file and have a key-map for it that looks like that: function! Escaped() call inputsave() let result = escape(@", '\\/.*$^~[]#...
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 ...
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 ...
0
votes
0answers
11 views

Opening multiple files both vertically and horizontally from the command line [duplicate]

I'm trying to open vim in a format like this, from the command line. |----------------| | | 2 | | |------| | 1 | 3 | | |------| | | 4 | |----------------|...
3
votes
2answers
78 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....
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 ...
0
votes
1answer
43 views

Ctrl w +/- not working as expected

I'm trying to use Ctrl w + and - to change my split width and height, but it's changing the font size instead. Any ideas about what's going wrong?
0
votes
1answer
24 views

Split causes the original viewport to scroll

Below, I call V1 the original viewport and V2 the new one. Start vim and write 5 sample lines. Leave the cursor in the last line. Issue :split. Expected behavior: V2 is opened below. V1 is inaltered,...
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
0
votes
1answer
39 views

How to map command+shift+right to widen vim split?

When I use 5<C-w>> in vim it makes my currently selected split increase by '5'. When I try to create this mapping on my Mac: noremap <silent> <D-S-Left> 5<C-w><<CR>...
0
votes
2answers
20 views

Vim misses a few files when opening multiple files

I use vim -o a* to open 25 files (filenames starting with 'a') together and search & replace (:windo %s/old/new/gcI) some common word in these files. Later I found that not all of them have been ...
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 | ...
0
votes
2answers
19 views

Open some files in split and some other in tab at the vim invocation

I have four files file1, file2, file3, & file4. So I want to open them with vim directly from command line and get the following structure: Tabulation 1: file1 taking whole tab Tabulation 2: ...
2
votes
1answer
56 views

Is there a way to resize a split such that it exactly fits its content (plus/minus N lines of buffer-space.)

I often find myself doing something like this with a tiny header file with only a few lines: Ctrl-W, ^ Ctrl-W, j 50, Ctrl-W, - 50, Ctrl-W, - 30, Ctrl-W, - 10, Ctrl-W, - … or similar, to slowly "zero ...
2
votes
2answers
39 views

Vsplit in resized GUI Window in .vimrc

When I'm in the GUI, I like to have a large-ish vim window: 161 columns, so I can :vsplit it into two 80 column windows (with 1 extra column for the gutter.) This works perfectly fine if I do it by ...
1
vote
0answers
23 views

Using fzf inside vim with double star completion

I wonder if it is possible to use fzf inside vim the same way it can be used on the command line. So, on the command line I can do vim file** and it will use fzf to search 'file'. I wonder if this is ...
1
vote
1answer
55 views

BufLeave: Auto save split file not working

I usually keep *.in files open in split and edit them. I would like vim to autosave the *.in files whenever I switch between splits. Searching other answers I found BufLeave that suits my case. I ...
2
votes
1answer
101 views

Change cursor position in another window

Is there a function like setpos that lets change the cursor position in a different window (split), given the window number? Or, even better, is there a command to execute a command in specific ...
2
votes
1answer
57 views

How to make :Vex / :Hex open on the right side / below

When working on a file, I often open another file by looking for the file by opening the file browser in a vertical split with :Vex Opening the file it's actually nice to have the file browser show ...
1
vote
0answers
34 views

No automatic scrolling when opening splits

When using plugins, splits are often created to show something, e.g. a quickfixlist or the taglist. If the split is opened (especially for horizontal splits), the original window is automatically ...
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?
1
vote
1answer
35 views

Why are split and tab navigations distinct?

Known: <Ctrl>w then any of hjkl. Known: :tab_<CR> where _ is either rlpn. Why is there not a <Ctrl> navigation for tabs nor a : for splits? Why do the navigation commands differ ...
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 ...
1
vote
1answer
72 views

Split window size change event

Couldn't find anything in autocommand-events, but is there may be a way to be notified if window split size was changed (with mouse or with C-w +)? What I try to achieve is to be able to auto-save ...
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 ...
1
vote
1answer
123 views

Split window vertically and edit visually selected file

I like what the shortcut Ctrl+Wf does, but I want to have a vertical split instead of horizontal. I managed to achieve this by defining the following mapping: nnoremap <c-w>f :vertical wincmd ...
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 ...
3
votes
1answer
69 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 ...
1
vote
1answer
39 views

Is it possible to have the cursor follow a newly-created window?

When I split my window (C-w v), is it possible to have the cursor automatically go to the new split right away? (I looked up switchbuf but I think that's something else; having to do with buffers ...
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?
1
vote
1answer
8k 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 ...
1
vote
1answer
121 views

Editing file in splits breaks the folding

My current workflow looks something like this: Open a file in different splits, each split showing a different section Make appropriate edits in each split :wq from the split after editing Repeat as ...
1
vote
1answer
167 views

Is it possible to manage tabs only within the single window in split mode?

Here is my situation. I launch tmux on iTerm2 and then split the window vertically (left and right), then make the right side of the window split horizontally. So now, there are 3 windows, one big at ...
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 ...
2
votes
2answers
92 views

Add buffer space on line wraps

Is there a way to add some buffer space between the vertical separator and the content of a file in vertical split mode? Another way to say this: How do I force vim to not let a line touch a vertical ...
2
votes
1answer
80 views

Trouble mapping <control-pipe> in new keybinds

I've recently decided to improve my multiple-pane Vim workflow, so I'm adding some new mappings to avoid the awkward <C-W> command. Here's what I have currently: " split-pane navigation remaps ...
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&...
0
votes
1answer
32 views

How can I specify “split or move” logic for <C-W><C-L> and similar move commands?

Is it possible to make <C-W><C-L> command to make split on the right, if it's the rightmost pane opened? Otherwise, it would behave like regular move. It's something like "conditional ...
1
vote
3answers
180 views

Command to copy from current window and paste the text into terminal buffer

I am having trouble crafting a command that would copy the text from the current window and paste this text into a terminal buffer opened in the split below. Here are a few things I tried: normal ...
2
votes
1answer
686 views

Replace netrw window when opening a file

I'd like to be able to :Sex when editing a file, select a file, press CR, and have that new split populated with the file I just selected. Is there an option for this? I think I became used to this ...
1
vote
2answers
217 views

How can I focus on one vimsplit fullscreen?

Say I've got three splits open with code in, and I suddenly want to make the one I'm in fullscreen, temporarily. How can I do that?
0
votes
1answer
38 views

How to open same file in multiple window but with changes present only in one window?

I want to view the initial copy of the file in a separate window while I make changes to the same file in another window. Is this possible?
1
vote
0answers
40 views

How to pin a file to a window(/viewport)

When I have multiple files open in multiple splits, when I open a new file via quickfix ( or Ctrl-P ), it sometimes ends up placing the new file in a window that I don't want to be changed. Is there ...
2
votes
1answer
293 views

Split same file into multiple windows “extending” each other

Suppose I have a long python file which is limited to 79 character or so in width. One very helpful feature would be if I could view the whole file separated into multiple vertical splits which "...
3
votes
2answers
1k views

How to toggle between split window layouts?

I am looking for a way to toggle between these two layouts: ------- | | | ------- ------- | | ------- | | ------- I only have two windows and I need to switch the layout often. I need a ...
-1
votes
1answer
168 views

Vim split screen opens blank split

I am trying to open a different file at some different location while i am working on a file in vim using split screen feature using vsp:cd.. / folder/filename after I hit enter it just shows me ...
0
votes
1answer
85 views

Equivalent of emacs `winner-undo` and `winner-redo`

Vim's C-w o is equivalent to Emacs's ESC ESC ESC, which closes all the Vim's windows (Emacs's buffers), except the current open one. In Emacs, with the command winner-undo and winner-redo one can ...
1
vote
2answers
1k views

How to remap <C-W>hjkl to navigate tmux panes and vim splits

I'm trying to use vim-tmux-navigator. I'd like to use default key bindings to move between vim and tmux splits. Which is <C-W>hjkl. But it isn't working. Either you can't remap anything with C-...
3
votes
1answer
238 views

Is it possible to simultaneously edit one file in two views?

I've been using Vim regularly for a decade, but still feel rather inexperienced because there is so much of Vim that I am not aware of and do not use. I sometimes want to see two different parts of ...
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 ...