2011年4月20日 星期三

Essential vim plugin - EasyMotion

I found a very handy vim plugin EasyMotion recently. It extend the original vim motions command like 'w', 'e', 'b', and 'f' and provide a new way to move to any position in screen according your selection.

The story is vim provides very powerful motion like move a word forward, back or jump to next character you typed and you can control how many times of move by '5w', '3b', or '3fk'. It's useful when scripting but not for visual operation. Does anyone count how many words before you move cursor? But it is handy when move one or two word forward or back but not move to the word half page away.

I have same problem too, especially in terminal. Actually I never use vim gui. I know where the target is in screen but need to move row and move character or word. I believe most people move cursor and observe the change rather count how many 'w' you should use.

Mouse support can help this. Click on a position and change cursor to there. But you have to move you hand out of keyboard and click and back to keyboard and not every terminal support mouse.

This plugin can help on this. You can use 'w', 'e', 'b', or 'f' to move by word or move to target character and then it show ALL matched position of screen and mark the position with a character. You press the character according visual mark and move cursor to there just like mouse click and don't need to move your hand away from keyboard.

My description make you confuse? Just check the demo and start to use it.

沒有留言: