2

I want a feature like vim's going forward or backwards command (w,e,ge,b) etc in the shell prompt. I am using tcsh shell in Linux. I would like to go 'n' number of words backs or forward etc and do some editing(may be append or replace). How can I do that? It doesn't have to be the exact same commands as vim but how do I achieve the same results in the shell prompt?

  • bindkey -v to run in vi-mode... – jasonwryan Aug 3 '13 at 6:22
  • @jasonwryan That should be an answer. – Bernhard Aug 3 '13 at 6:45
  • @jasonwryan how to come back to default mode which is emacs I suppose? I did go vi mode by using bindkey -v but unable to return to the default mode. – Geek Aug 3 '13 at 8:15
4

By default shells are in emacs mode.

Pressing alt+B will send the cursor back one word on the command line. Pressing alt+F will send the cursor forward.

Running bindkey -v will switch to vi mode. You'll need to press esc then vi commands will work. Running bindkey -e will switch to emacs mode.

  • for me alt+b or alt+f are not working in default(emacs mode). But Escape+f and escape+b are working fine. – Geek Aug 3 '13 at 15:22
  • alt+f is actually invoking gnome terminal's File menu. – Geek Aug 3 '13 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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