Vim tweaks: Difference between revisions
Jump to navigation
Jump to search
(Created page with "I often split my vi session so I can compare textfiles when coding some basic php stuff. To split a page with vim, run :sp <filename> or :vsp <filename>. :sp will split the ...") |
No edit summary |
||
Line 2: | Line 2: | ||
To split a page with vim, run :sp <filename> or :vsp <filename>. | To split a page with vim, run :sp <filename> or :vsp <filename>. | ||
:sp will split the Vim window horizontally. The existing file text will be shown on the bottom or top half of the screen, and the newly opened file will be shown above or below this text. | |||
:vsp will split the Vim window vertically. The existing file text will be shown on the left or right half of the screen, and the newly opened file will be shown on the remaining part of the screen. | :vsp will split the Vim window vertically. The existing file text will be shown on the left or right half of the screen, and the newly opened file will be shown on the remaining part of the screen. |
Revision as of 19:01, 2 November 2013
I often split my vi session so I can compare textfiles when coding some basic php stuff. To split a page with vim, run :sp <filename> or :vsp <filename>.
- sp will split the Vim window horizontally. The existing file text will be shown on the bottom or top half of the screen, and the newly opened file will be shown above or below this text.
- vsp will split the Vim window vertically. The existing file text will be shown on the left or right half of the screen, and the newly opened file will be shown on the remaining part of the screen.
To switch between the views (also referred to as viewports) you use ctrl-w in combination with other keys:
Ctrl-w Ctrl-w moves between Vim viewports.
Ctrl-w j moves one viewport down.
Ctrl-w k moves one viewport up.
Ctrl-w h moves one viewport to the left.
Ctrl-w l moves one viewport to the right.
Ctrl-w = tells Vim to resize viewports to be of equal size.
Ctrl-w - reduce active viewport by one line.
Ctrl-w + increase active viewport by one line.
Ctrl-w q will close the active window.
Ctrl-w r will rotate windows to the right.
Ctrl-w R will rotate windows to the left.