Questions tagged [vim-windows]

A Vim window is a view of a buffer. A tab page comprises one or more windows. For questions about interaction with the Microsoft operating system, use [microsoft-windows]. For questions about interaction with the desktop windowing system, use [window-management].

In Vim, a window is a visual view of a buffer. There can be multiple (or no) windows associated with any given buffer, and each window can be in a different state (e.g., viewing a different part of the buffer). Windows are grouped together in tab pages.

Some common operations on windows:

  • Quickly create windows with the :split and :vsplit commands. Execute :split to divide the current window horizontally into two views of the same buffer, and use :vsplit to divide the window vertically. By providing an argument to :split or :vsplit, you can specify a different file to view in the new window.

  • Switch windows with the <C-W> commands. Press <C-W> and then one of h, j, k, or l to move left, down, up, or to the right, respectively.

  • Close a window with <C-W>c or :q.

See :help windows within Vim for more information.

313 questions
15
votes
3 answers

How can I get my windows back into a grid formation?

If I have windows arranged into four quadrants, as from the following sequence of commands: :tabnew :vsplit :split l :split then entering a command like J will cause these to no longer be square; in this case, it will force one window to…
wchargin
  • 2,717
  • 14
  • 24
9
votes
2 answers

Is there any way to edit ipynb files by using vim?

I want to access Jupyter notebook from inside vim. I have compile vim with Python support, and try this plugin http://github.com/ivanov/vim-ipython. The documentation suggest me to run :IPython command. This seems to not working at all. Some thread…
goFrendiAsgard
  • 333
  • 1
  • 3
  • 8
9
votes
4 answers

How do I automatically size a window?

I often program with lines no more than 80 characters long. I start with an 80-character-wide terminal, but sometimes due to a plugin runs or after creating a vsplit results in the editing area being less than 80 characters wide. For example, :set…
drs
  • 3,028
  • 3
  • 23
  • 27
8
votes
4 answers

Switching .c/.h buffers

I normally work with 2 windows, vertically split. The problem I would like to solve, is: easily jumping back and forth from header <-> implementation file I'm investigating, without luck, 2 ways to do this: Open alternate file in current window:…
zach
  • 81
  • 2
7
votes
4 answers

How to convert all windows into horizontal, vertical or tab splits?

It is possible to convert all windows into different split mode while editing? Instead of one by one? In example (having multiple windows) from horizontal to vertical split and opposite, or from tab split all files into horizontal/vertical view and…
kenorb
  • 18,433
  • 18
  • 72
  • 134
7
votes
2 answers

How to force which border shifts when resizing windows?

Is there some way to resize windows without using the mouse, such that I can control which border moves? It seems like it's ordinarily the bottom border or right border that moves, relative to the window my cursor is in. I've found some cases where…
dannyadam
  • 482
  • 2
  • 6
7
votes
3 answers

Detect if window has neighbour in given direction

Is there a robust way to detect whether a window has a neighbour in a given direction? So far, the only solution I found uses wincmd, let winnum = winnr() noautocmd wincmd h if winnum != winnr() noautocmd wincmd l return 0 else …
Rastapopoulos
  • 533
  • 3
  • 14
5
votes
1 answer

Can you increase the span of a window?

Let's say I have a window layout like below: [1][2] [3..3] And I want to expand window 2 to look like this: [1][2] [3][2] So window 2 will now be full height
flukus
  • 275
  • 1
  • 4
5
votes
1 answer

Emacs switch-window for vim

There is an emacs plugin called switch-window which indexes all open windows and allows the user to switch a window based on it's number. This is really convenient when you have a large number of windows open. Does anyone know if there's something…
user886596
  • 297
  • 2
  • 5
4
votes
1 answer

Open text file in an existing console vim window

I wanted to know if there might be a way to open a text file in an existing console vim. This would really help my current workflow. I default to sublime when opening things from the desktop because I haven't been able to find a good way to do…
Phaino
  • 175
  • 2
  • 7
4
votes
2 answers

Open split window at far left

I use :vs to open a window. If I want this window to be the leftmost window, no matter what the currently active window is, how can I do it?
eyal karni
  • 1,106
  • 9
  • 33
4
votes
2 answers

Always open terminal window at the bottom

My ideal editing layout would look like this (in Gvim): ---------------------------------------------------------- | | | | | N | | | E | …
Scott Severance
  • 367
  • 4
  • 11
3
votes
1 answer

Preventing extra window split

:help in Vim will do a window split if there is no help window. If there is a single window, this is fine. But when there is already a split (vertical or horizontal), I would like to see the help in a new buffer in another window rather that adding…
Igor Bukanov
  • 149
  • 1
3
votes
1 answer

How to determine which window cursor will move to after closing preview window?

I am trying to fix a bug that goes like this: [cursor in ordinary window] open preview window and move to it [cursor in preview window] close preview window expected: cursor moves to where it was in step 1 actual: cursor ends up in another…
Andy Stewart
  • 1,349
  • 8
  • 13
3
votes
1 answer

Get the position of a split window inside of vim

Is there any way to get the position of the top left corner of a split window relative to the entire vim window? For example, if there was only one window, and the tabline was inactive, the position would be 1,1. But, if the tabline was active, and…
Prismavoid
  • 83
  • 4
1
2 3