Much of the time in vim you'll want to goto the beginning or end of a line. My solution thus far has been to just press "l" until I get to the end, but that takes a long time on some long lines. Another bad solution is to just hit "w" or "e" to go by every word. But that can be annoying because if your reflexes aren't good, the cursor will just end up on the next line
Solution
- To goto the end of a line
- hit "$". If your familiar with regular expressions, this signifies the end of a line. If you would like to goto the end of a line and enter edit mode, hit "A".
- To goto the beginning of a line
- hit "0" or "^". I personally find it easiest to hit "0", but if you're familiar with regular expressions, "^" signifies the beginning of a line. If you would like to goto the beginning of a line and enter edit mode, hit "I".
Conclusions
These commands will allow you to be a lot faster when editing your code.
Resources:
- http://stackoverflow.com/questions/10243551/go-to-beginning-of-line-without-opening-new-line-in-vi
- http://stackoverflow.com/questions/105721/how-to-move-to-end-of-line-in-vim
NOTE: This guide is currently in rough draft form and could be improved with clearer instructions and pictures. If you would like it to be more in depth, I will be extremely happy to improve on this, all you need to do is ask in the comments and I will do it asap (I just don't want to spend forever on something no one reads and/or cares about).
No comments :
Post a Comment