3 ms·
I actually use a whole bunch of things for motion. backward-sexp is really nice, but very lisp specific, and I only rarely get to hack on lisp stuff. I use a co
by mattbriggs 15y ago
I actually use a whole bunch of things for motion. backward-sexp is really nice, but very lisp specific, and I only rarely get to hack on lisp stuff. I use a combination of the following to jump around, and rarely find things lacking. My exact bindings probably break common emacs-isms and would be sacrilege to a true emacsen, but they work well for me :)
If the cursor is more then a few lines away, i will use / to search (or ? to back search) and then n my way to the target.
If I am on the same line, I will use f<target char> . that will move the cursor to be on the the next occurance of that character, and semi-colon repeats the motion. so given
the quick brown fox jumps over the lazy dog
if the cursor is at the start of the line and i want to get to the o in over, I would type "fo;;" seems a bit verbose, but ; is easy to hit, and sort of a twitch motion, so it is actually pretty natural.
If the place I want to get to is close to the beginning or ending of the line, i have ^(go to first non whitespace char) mapped to H, and $(go to end of line) mapped to L. given the vim hjkl bindings, HL is very easy to hit.
If I am more just "cruising" through the file, i have c-h mapped to b (back a word) and c-l mapped to w (forward word), and c-j to } (next paragraph) c-k (prev paragraph). So holding down ctrl puts me into "move quickly mode"
If I am close to a paren, I have % mapped to <space><space>, but that is mostly situational (i find I use it most often in lispy languages)
If I am on a word and want to move to another occurance of the same word, I usually use * and n my way to where I want to be (although I also use highlight-symbol.el with m-n m-p mapped to next/prev occurance)
Finally, something I just started trying out is jaunte.el. Done by a japanese guy, but if you look at the screencap here http://translate.google.com/translate?hl=en&sl=ja&u=http://kawaguchi.posterous.com/emacshit-a-hint&ei=Uc5JT-bVKczOgAfK2umbDg&sa=X&oi=translate&ct=result&resnum=1&ved=0CCMQ7gEwAA&prev=/search%3Fq%3Djaunte.el%26hl%3Den%26biw%3D1517%26bih%3D726%26prmd%3Dimvns http://translate.google.com/translate?hl=en&sl=ja&u=... you can see when you invoke it, it puts an overlay over each visible word with a 1-3char shortcut. You press the shortcut, and jump to that place.
So yeah, YMMV and all that, but that is what I use for motion. Out of all of that, / and f are by far the most common things I use.