Questions tagged [split]

Questions about splitting current window into multiple viewports.

Filter by
Sorted by
Tagged with
1
vote
0answers
22 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
76 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
53 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 ...
24
votes
5answers
4k 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
35 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
36 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 ...
23
votes
2answers
11k 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
5k 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
78 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
125 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 ...
125
votes
6answers
67k 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?
4
votes
1answer
44 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
46 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
29 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 ...
4
votes
1answer
647 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
29 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
152 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 ...
1
vote
1answer
299 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
106 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
34 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
32 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
159 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 "...
2
votes
2answers
726 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
106 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 ...
32
votes
5answers
15k 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
1answer
52 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-...
0
votes
0answers
32 views

How to stop Vim changing color of the empty space on its own?

I didn't know what is the best title for this question. This problem is annoying me so much. I'm on Windows 7 and using nvim-qt. When I search for a word in the project or for example open NERDTree ...
3
votes
1answer
137 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 ...
0
votes
0answers
60 views

Using different listchars in splits

I have normally set up my listchars to make tab characters and trailing spaces visible. In my ~/.vim/vimrc I have: set listchars=tab:»\ ,trail:· Now there are certain file types where tabs are ...
17
votes
4answers
4k 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 ...
2
votes
1answer
63 views

How to scroll two vertical splits at the same time?

I am not sure if it is even possible but, when I am working with vertical splits, sometimes, I want both of them to scroll up/down at the same time rather than using this combination: scroll down ...
34
votes
2answers
9k 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 ...
11
votes
3answers
5k 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?
2
votes
1answer
368 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?
1
vote
0answers
255 views

How to close splits automatically when changing file or closing VIM?

I am trying to create my own IDE like setup inside of VIM. This is what I have. I am also using Tmux here if you wonder about the bottom terminal screen. If I change file to another CPP within ...
1
vote
1answer
210 views

Why do windows not have syntax after split?

I am trying to create my own C++ environment inside of VIM. So far, this is my setup when I run $ vim ~/shape.cpp: for example: As you can see, only NERDTree has full syntax highlighting (which isn'...
0
votes
1answer
49 views

What's the Vim equivalent of Emacs's other-window command?

What's the Vim equivalent of Emacs's other-window command?
4
votes
2answers
134 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 ...
-1
votes
1answer
98 views

Why does :new create a split?

Why does :new create a split? What is the use case for that functionality? Normally when I open a new scratch buffer, I don't want it to be in a split.
3
votes
2answers
308 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 ...
0
votes
1answer
345 views

Split resizing with mouse not working after upgrade from ubuntu 16.04 to 18

I use to be able to resize my vim splits using the mouse in the terminal by clicking on the borders and dragging. Now I can't. How can I make it work again? edit: still works in gvim but doesn't work ...
2
votes
1answer
521 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=...
3
votes
4answers
523 views

Reopen splits after closing them with <C-w>o

I majorly use vim over an ssh session using putty. Sometimes I may have to copy code from ssh in a vim session but it's not very convenient. I do the following : <C-w>o :set nu! This close all ...
4
votes
3answers
5k 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 ...
6
votes
0answers
272 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 ...
1
vote
2answers
203 views

How to obtain fine-grained control over split sizes when using a large number of splits?

Let's say I have ten splits as follows: |0|1|2|3|4| |5|6|7|8|9| I now try to reduce the width of split 1 to be able to increase split 3 quite a bit (whoever wrote that particular file, used fairly ...
7
votes
4answers
407 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 ...
1
vote
1answer
227 views

shortcut to open definition of variable in a vertical split

I use the vertical split command a lot :vsplit, and I also have click on ctrl] to look at the definition of a variable (after generating the Ctags). I would like to do a keyboard shortcut that does ...
0
votes
2answers
397 views

Buffer variable is not set after :vs <file>

I've noticed that after I use :vs <file> or :sp <file> I have no buffer variables defined for this buffer. So I get E121: Undefined variable: b:Var after :echo b:Var there. But in the ...