Vim Tips Wiki
(Adjust previous/next navigation)
(Corrected a typo.)
Line 15: Line 15:
 
<pre>
 
<pre>
 
:noremap L 4l
 
:noremap L 4l
:noramap H 4h
+
:noremap H 4h
 
</pre>
 
</pre>
   

Revision as of 18:17, 23 December 2010

Tip 1458 Printable Monobook Previous Next

created January 6, 2007 · complexity basic · author sply · version 5.7


To accelerate your motion when moving the cursor, use:

:noremap L 4l
:noremap H 4h

and maybe

:noremap J 4j
:noremap K 4k

Now when you are moving around your text, press Shift to get the cursor accelerated. Yes, the old meaning of H,J,K,L is changed.

Comments

If you use 'w' or 'b' to move, the cursor jumps unevenly, so you must:

  • Press it somewhat slowly as your eye tracks where the cursor moves with each press; or
  • Count (or estimate) the number of words to jump, press the key sequence, then correct any mistake you made.

Another option is to use 'f<char>' (followed by ';'), but this is a similar case:

  • Find a character close to where you want to go (e.g. h), press 'fh', and keep pressing ';' until you get close by.

All three options require the eye to actively track the cursor and/or the mind to count words. However, if you just hold down 'l' (or in this tip's case, 'L'), you needn't think about it. The cursor moves at a steady pace, so the eye (and mind) can estimate the destination based on timing. This is not possible using 'w', since it does NOT move steadily.


Why not use something like:

map <c-up> 5k
map <c-down> 5j

which map Control-up-arrow and Control-down-arrow. On my system <c-left> and <c-right> do not need to be mapped because they already map to previous and next word.


When you want to move closer to the middle of a line, you have the built-in normal mode command gm


How do you join lines when you have mapped J