PuTTY - When press Up arrow to show command from history, it forces me to edit command in vi? How to change?
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
Related videos on Youtube
user1776193
Updated on September 18, 2022Comments
-
user1776193 over 1 year
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
-
Mike Fitzpatrick over 10 yearsYour issue is related to the machine you are using PuTTY to connect to, not with PuTTY. You'll need to supply us with more info about the operating system and shell you are connecting to.
-
romainl over 10 yearsBash and all other shells that use the readline library use emacs editing mode by default. Either you set your shell to work like that or someone else did it for you.
-
user1776193 over 10 years@tvm that fixed the issue!
-