VI editor "ESC" key and "Ctrl + [" do not work correctly
It is possible that there is something in your ~/.vimrc file that is causing problems. You might try moving your .vimrc file to a temporary one, then start vim basically without a configuration and see if the problem persists. If it does then put the file back and start commenting things out until you find it.
It is also possible that your terminal is passing through weird keystrokes or something.
Comments
-
KyleC almost 2 years
I am a complete beginner with VI editor.
I had a chance of using the VI editor by typing
git commit
instead ofgit commit -m "my comment"
when commenting my commit to my git repository.I learned that I would go into "edit" mode by pressing
i
in the VI command line. And I also learned that I go back to the command mode by pressing eitherESC
key orCtrl + [
key combination. However, neither keys get me out of the "edit" mode.What happens is that pressing either keys do the same thing, something that seems like accumulating ESC key. Each time I press either key, I see something like below in the bottom line of the screen:
- Pressed once:
ESC-
- Pressed twice:
ESC ESC-
- Pressed three times:
ESC ESC ESC
Since I know that the command to save and exit is
:wq
, when I pressESC
one time and followed by:
, the command line immediately turns into toEval:
. It seems likeESC + :
is the key combination for such command.This seems weird. What would be the problem and how could I fix it?
Thanks in advance for your help.
Edit
I found the below codes from
.gitconfig
file in my root directory. Is this causing the problem?[core] autocrlf = input safecrlf = true editor = emacs
SOLVED! My problem was due to the
[core] editor
part of the global settings of.gitconfig
. Once I changed it toeditor = vi
I was able to exit out using VI's shortcuts. Thanks everybody for helping me out. -
KyleC almost 9 yearsHello.
[core] editor = emacs
I found the above from .gifconfig file in my root directory. I remember following someone's settings in a tutorial. Is this a problem? -
Ricky Nelson almost 9 yearsIt could be if you are wanting to use vim, change emacs to vim and see if that helps.
-
KyleC almost 9 yearsIt was the problem with my settings in the global
.gitconfig
Thanks for your input!