Just hitting the same problem today.
Logged in remotely to a server I need to edit a file on. Starting vi works, loads the file, editing is possible.
Unable to leave vi whatsoever. Something looks wrong with the key behaviour.
Hitting "ESC" produces a
instead of the expected
so no way to leave vi and also no way of leaving the active ssh console
Any inputs on how to deal with that?
Workaround
How to get out of vi. (Careful, this is forcing something which could leave you with unwanted outcome! I assume no resonsability whatsoever!)
Open a second console window.
Open a second ssh connection to the affected host your stuck in vi
Do the following:
First list all processes. Find the affected vi process which should be pretty much at the bottom anyway with:
and use the "space" bar to scroll pagewise through the process list.
Then use:
where xxxx is the process number of the vi command in which you are stuck to kill the vi process. You should be back on the ssh prompt. Now you can normally exit the ssh shell on both consoles.