(Move categories to tip template) |
No edit summary Tags: Visual edit apiedit |
||
(19 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
− | {{review}} |
||
{{TipImported |
{{TipImported |
||
|id=278 |
|id=278 |
||
|previous=277 |
|previous=277 |
||
|next=279 |
|next=279 |
||
− | |created= |
+ | |created=2002 |
|complexity=basic |
|complexity=basic |
||
|author=vim_power |
|author=vim_power |
||
− | |version= |
+ | |version=6.0 |
|rating=78/45 |
|rating=78/45 |
||
− | |category1= |
+ | |category1=Getting started |
|category2= |
|category2= |
||
}} |
}} |
||
Line 17: | Line 16: | ||
<pre> |
<pre> |
||
− | h move one character left |
+ | h move one character left |
− | j move one row down |
+ | j move one row down |
− | k move one row up |
+ | k move one row up |
− | l move one |
+ | l move one character right |
− | w move to |
+ | w move to beginning of next word |
− | b move to |
+ | b move to previous beginning of word |
− | e move to end of word |
+ | e move to end of word |
− | W move to |
+ | W move to beginning of next word after a whitespace |
− | B move to |
+ | B move to beginning of previous word before a whitespace |
− | E move to end of word before a whitespace |
+ | E move to end of word before a whitespace |
</pre> |
</pre> |
||
− | All the above movements can be |
+ | All the above movements can be preceded by a count; e.g. <code>4j</code> will move down 4 lines. |
<pre> |
<pre> |
||
− | + | 0 move to beginning of line |
|
− | + | $ move to end of line |
|
− | + | ^ move to first non-blank char of the line |
|
+ | _ same as above, but can take a count to go to a different line |
||
⚫ | |||
+ | g_ move to last non-blank char of the line (can also take a count as above) |
||
⚫ | |||
− | G move to last line. |
||
− | nG move to "n"th line. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | '[a-z,0-9,A-Z] jump to the marker. (you can set a marker on line by :- m[a-zA-Z,0-9] and then jump back to it by '[a-z,A-Z0-9] |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | A very useful one for me is: |
||
+ | nG move to n'th line of file (where n is a number) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | z. put the line with the cursor at the center |
||
− | ---- |
||
+ | zt put the line with the cursor at the top |
||
+ | zb put the line with the cursor at the bottom of the screen |
||
+ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | Ctrl-i jump to next cursor position |
||
+ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | |||
⚫ | |||
⚫ | |||
+ | |||
+ | See <code>:help {command}</code> (for example, {{help|g_}}) for all of the above if you want more details. |
||
+ | |||
⚫ | |||
+ | Ctrl-i jump to previous cursor position |
||
+ | <C-i> (or <Tab>) goes to the next cursor position in the jump list, and does nothing unless you've already moved to an older position in the jump list using <C-o>. ([[User:Spiiph|Spiiph]] 12:37, October 5, 2009 (UTC)) |
Revision as of 16:49, 15 September 2015
Tip 278 Printable Monobook Previous Next
created 2002 · complexity basic · author vim_power · version 6.0
One of the principles of effective text editing is moving around very efficiently.
Following are some pointers which may help you do that.
h move one character left j move one row down k move one row up l move one character right w move to beginning of next word b move to previous beginning of word e move to end of word W move to beginning of next word after a whitespace B move to beginning of previous word before a whitespace E move to end of word before a whitespace
All the above movements can be preceded by a count; e.g. 4j
will move down 4 lines.
0 move to beginning of line $ move to end of line ^ move to first non-blank char of the line _ same as above, but can take a count to go to a different line g_ move to last non-blank char of the line (can also take a count as above) gg move to first line G move to last line nG move to n'th line of file (where n is a number) H move to top of screen M move to middle of screen L move to bottom of screen z. put the line with the cursor at the center zt put the line with the cursor at the top zb put the line with the cursor at the bottom of the screen Ctrl-D move half-page down Ctrl-U move half-page up Ctrl-B page up Ctrl-F page down Ctrl-o jump to last cursor position Ctrl-i jump to next cursor position n next matching search pattern N previous matching search pattern * next whole word under cursor # previous whole word under cursor g* next matching search (not whole word) pattern under cursor g# previous matching search (not whole word) pattern under cursor % jump to matching bracket { } [ ] ( )
See :help {command}
(for example, :help g_) for all of the above if you want more details.
Comments
Ctrl-i jump to previous cursor position <C-i> (or <Tab>) goes to the next cursor position in the jump list, and does nothing unless you've already moved to an older position in the jump list using <C-o>. (Spiiph 12:37, October 5, 2009 (UTC))