This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tips:tools:vim [2011/05/11 10:20] mattieu created |
tips:tools:vim [2011/05/11 10:36] (current) mattieu |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== vim tips ====== | ====== vim tips ====== | ||
- | ===== Using splits | + | ==== Using splits ==== |
Very useful to open multiple files on the same screen or the same file at different places. Splits consists of sharing the vim's screen. | Very useful to open multiple files on the same screen or the same file at different places. Splits consists of sharing the vim's screen. | ||
There are basically two possibilities : | There are basically two possibilities : | ||
- | split = horizontal split | + | * split = horizontal split |
- | vsplit = vertical split | + | |
- | ==== When starting vim ==== | + | === When starting vim === |
<code bash>$ vim -o foo bar = open foo and bar in split | <code bash>$ vim -o foo bar = open foo and bar in split | ||
$ vim -O foo bar = open foo and bar in vsplit</ | $ vim -O foo bar = open foo and bar in vsplit</ | ||
- | ==== When vim is already started | + | === When vim is already started === |
' | ' | ||
<code bash>^w s = share the screen horizontally in two | <code bash>^w s = share the screen horizontally in two | ||
^w v = share the screen vertically in two</ | ^w v = share the screen vertically in two</ | ||
- | ==== How to move inside splits | + | === How to move inside splits === |
<code bash>^w j = select the bottom split | <code bash>^w j = select the bottom split | ||
^w k = select the top split | ^w k = select the top split | ||
Line 22: | Line 22: | ||
^w - = reduce the current split a line</ | ^w - = reduce the current split a line</ | ||
- | ==== How to move inside vsplits | + | === How to move inside vsplits === |
<code bash>^w h = select the vsplit on the left | <code bash>^w h = select the vsplit on the left | ||
^w l = select the vsplit on the right | ^w l = select the vsplit on the right | ||
Line 30: | Line 30: | ||
^w [up, | ^w [up, | ||
- | ==== How to move splits | + | === How to move splits === |
<code bash>^w H = move on the left | <code bash>^w H = move on the left | ||
^w L = move on the right | ^w L = move on the right | ||
Line 36: | Line 36: | ||
^w J = move on the bottom</ | ^w J = move on the bottom</ | ||
- | ==== How to close splits | + | === How to close splits === |
<code bash>^w q = close the current split | <code bash>^w q = close the current split | ||
^w o = close all the splits but the current</ | ^w o = close all the splits but the current</ |