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.
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.
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.
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.
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.
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With