mandag 19. september 2011

VIM hacks: window management

Opening more windows and navigating between them inside vim is easy, it all just takes a bit of getting used to. Here are the commands we use for creation/navigation and movement:
open a new window with a new or existing file inside vim:
(everything in command mode, <Esc> to get there.)
:new filename.html
Move the window left/right:
<Ctrl>+w H (left) / <Ctrl>+w L (right)
Navigate between the windows:
<Ctrl>+w h (left) / <Ctrl>+w l (right) / <Ctrl>+w j (down) / <Ctrl>+w k (up)
Exiting a window?
- it's just like any other file: :q to quit without saving, :wq to write the changes, then quit.
Resizing windows (applies to current window):

  • <Ctrl>+w + (more height)
  • <Ctrl>+w - (less height)
  • <Ctrl>+w > (increase width) 
  • <Ctrl>+w < (decrease width)

Like all commands in vim, it can be multiplied by putting a number before the last symbol (e.g <Ctrl>+w 5< would decrease the width five times the default value).


These are some of the commands I find most important, for more visit http://vimdoc.sourceforge.net/htmldoc/windows.html#window-resize 

Ingen kommentarer:

Legg inn en kommentar