

I have solved the same problem by setting: One may also do the dual thing for vertical splits/window changes: Hope this helps those of you who are working on projects with large numbers of files you're constantly flipping through. This sets the minimum window height to 0, so you can stack many more files before things get crowded. (2) By default, Vim displays the current line of each minimized file, which (to me) isn't much help and takes up too much screen real estate.
#Macvim change buffers windows#
Now I can hold down Ctrl and move between windows with the standard Vim movement keys. To help avoid this problem, I created this mapping in my. That's four keystrokes (more if you count Ctrl and Shift), and they are all over the keyboard. (1) In order to move to the file in the split above my current window, I was typing Ctrl-W, Up (move up a window) Ctrl-W, _ (maximize the window). My problems were that (1) it took too long to move between files, and (2) the files were taking up too much room on the screen. If you don't already know, Vim supports this very well! Just use:

Most programming projects (and Web programming projects, in particular) are spread out over multiple files, which you often want to have open concurrently. I am a Web developer and I use Vim as my primary editor. So now you should be able to have a single Vim "window" or session with many vim-windows within it to get a custom view over a single long file or maybe a project of many source files.Alt+leftarrow will go one window left, etc. Quick note, you can view all buffers with :ls and use :b and type some text to switch to another buffer, which will change the contents of the current window to that buffer.īut to close a window, you can either :q (you should be familiar with this as a way to close vim) or C-w q. Buffers are another subject altogether, which go together with windows. Closing a window doesn't close the file (or buffer). Some people bind a key to both switch to a window and maximize it at the same time. You can also maximize (thus shrinking all other windows) the window with C-w _. 20 C-w > increases window width by 20 columns. Decrease the height by 10 lines: 10 C-w -.Ĭhange width using the window command and. Increase the height of the current window by 5 lines: 5 C-w +.

To go to window #2: C-w 2 C-w.īesides thinking which window you want to go to and which direction it is, you can quickly cycle through windows: C-w C-w You can also teleport directly to any window by knowing which absolute number / index the window is. Combine with the window command C-w, e.g. Likewise, you can use those keys to navigate to windows above (k), below (j), left (h), right (l) of the current window, without cycling through when reaching the end. Recall that vi/vim navigation usees the hjkl keys. But you can also use your keyboard (of course). You can use your mouse cursor (in graphical / MacVim) to change focus (moving the blinking cursor) to another window. But you can split vertically (creating a new vertical border in the middle) with :vsp or C-W v. :sp splits the current window into two above each other, creating a horizontal separator. As always, C- means to press control and the given key. And you can change split points through ex commands, control commands, and by using your mouse. And you can split windows both vertically (side by side) and horizontally (default). In fact, you can view the same file at different lines in different windows. So you can view multiple files in other "windows" in the same Vim session. In MacVim, you can even access a tiny slice of this through the Apple menu (File -> Split-Open).

A lifechanging feature of Vim for me was the window-splitting feature.
