Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

 % someCommand.pl --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

1 Answer 1

The elisp code fragment

(setq saved-point (point))
(begining-of-line)
(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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.