PuTTY - When press Up arrow to show command from history, it forces me to edit command in vi? How to change?

When I am in PuTTY, and I execute a bunch of commands, I often want to use the same command I just used. So I press the "Up" arrow. The last command now shows up, but I want to edit it a little.

I couldn't figure out how to edit it, until I realised it let me edit it using "vi" commands.

Does anyone know what setting in PuTTY I have to change to allow me to edit it normally instead of having to use "vi" commands?

Thanks

4

1 Answer

This is not the PuTTy issue, It's caused by bash readline.

I think the result would be looks like mine if you execute the following two commands:

$ bind -v | grep keymap
set keymap vi-insert
$ bind -v | grep editing-mode
set editing-mode vi

That means, the bash shortcut was set as vi-like (default is emacs-like). If you want to revert to original, input the following two commands:

set editing-mode emacs
set keymap emacs

And re-start your PuTTy. I think everything will be fine.

However, if this is the public server, and many people are all using it. You can try find previous-history by using ctrl + p. Or find the shortcuts about previous-history by:

$ bind -p | grep previous-history
"\C-p": previous-history
"\eOA": previous-history
"\e[A": previous-history
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like