Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding windows in Vim

Tags:

vim

I have an understanding of buffers, but I am unsure as to how to navigate through windows? I use the Ack plugin and NERDTree. If I search for something in Ack while having both the NERDTree window and my main coding window open, how can I switch between these three different windows?

Occasionally, I accidentally open a file that takes over the NERDTree window, so now I have two windows with code, and one Ack window. Then I have to end up closing the buffer I opened, which ends up closing the window, then reopening NERDTree.

like image 320
tipu Avatar asked Apr 27 '11 23:04

tipu


People also ask

What is a window in Vim?

A Vim Window is what you see and interact with. A Window always shows a Buffer, being it from a file or just an empty one. Many windows can be opened at the same time by splitting the editor. Ctrl-w s , :split [filename] split the window, optionally opening a new file.

How do I navigate Windows in Vim?

To move from the current Vim window to the next one, type CTRL-W j (or CTRL-W <down> or CTRL-W CTRL-J). The CTRL-W is the mnemonic for “window” command, and the j is analogous to Vim's j command, which moves the cursor to the next line.

Is Vim useful for Windows?

Vim is a powerful code editor. So powerful that both Linux and Mac have it installed by default. But if you are using Windows as your operating system, you will need to install Vim separately. Fortunately, Microsoft makes it very easy to install Vim and get it running on your PC.

How do I minimize a window in Vim?

CTRL-W- decreases the current window height by one line. Vim also has an ex command that lets you decrease the window size explicitly. For example, the command resize -4 decreases the current window by four lines and gives those lines to the window below it.


1 Answers

You can move between windows by doing the following: Ctrl-w followed by a directional key, for example h, j, k, or l (or by using the correspondingarrow keys).

like image 63
josh-fuggle Avatar answered Sep 28 '22 15:09

josh-fuggle