Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've noticed my navigation of my own command-line is rather clunky, e.g. for a command like:

 % --foo 123 --bar 456 --foobar 789 

My cursor begins on the "9" and I want to move it to just after the "3". I currently do a rather dumb combination of jumping to the beginning of words, then the end of the word.

I'd rather just to a "jump-to-this-specific-character" command. Does emacs have this command? Is there a shorter key sequence to get me where I want?

The problem with doing a ctrl-s incremental search is:

  • I have to explicitly hit "esc" to get out of the search mode
  • If I overshoot the search, I end up searching older commands in my command-line history, which I don't want. I simply want to quickly jump around in the current command.

Am I over-thinking this?

share|improve this question

The elisp code fragment

(setq saved-point (point))
(and (searchforward string (line-end-position) t)
     (goto-char saved-point))

will look for the first occurence of string on the current line, and leave the cursor at the current point if there isn't such an occurence.

How do you want to incorporate such code into practice? You could bind a key to be a prefix that waits for the next key, and looks for the string containing just that character.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .