Terminal showing “^[OA” when up arrow (↑) is pressed - terminal

The up arrow in the terminal should bring up the previous command. My terminal (including iTerm2 and Intellij IDEA terminal) shows ^[OA when I press the up arrow (↑).
If I press return, the previous command is still executed. It works fine and I can see the command if I press CTRL+C first.

Related

code . & exit in cmd terminal doesn't work as expected

I would like to open vscode in the cwd and exit the Windows cmd terminal from which the command is issued at the same time.
code . (with a . for cwd) launches vscode in the cwd. exit closes the terminal. But as issuing the first command makes the terminal loses focus, I need to give it back to it to issue the second command.
I would like to type a single line command that does both actions at once, thus without the terminal losing its focus.
code . & exit doesn't work as the terminal window remains open and hangs infinitely with a flashing cursor. Ctrl-C doesn't bring the cmd prompt back and clicking the upper right x is the only way to close the terminal window when in that state. (vscode opens correctly in the cwd thought.)
How to do so?
call code . & exit does the trick!

Sending signal to bash shell launched in GVim

How do I send a signal (say, SIGINT), to a shell launched inside GVim, using a keyboard shortcut?
Neither Ctrl+C nor Ctrl+D seem to work.
Ctrl+D seems to work for me, at least for closing a terminal session. Crl+C however does not. If you only want to kill a running process, you can do this workaround (provided Ctrl+Z) works for you.
Press Ctrl+Z to pause the process, then
kill %1
to kill the process in the background.
Inside vim, use command :shto temporarily exit vim and go to shell
If you want to go back to vim then press Ctrl + D. This work for me for years.

VI editor "ESC" key and "Ctrl + [" do not work correctly

I am a complete beginner with VI editor.
I had a chance of using the VI editor by typing git commit instead of git 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 either ESC key or Ctrl + [ 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 press ESC one time and followed by :, the command line immediately turns into to Eval:. It seems like ESC + : 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 to editor = vi I was able to exit out using VI's shortcuts. Thanks everybody for helping me out.
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.

Vim shell command messages output printed outside vim editor

Normally, whenever I enter shell command like !ls or rm file in vim, the message along with confirmation prompt will be printed below vim status line. My issue is, when I'm doing shell command, the message is printed out outside vim editor (like it was minimized) and then bring me back to the editor after I press enter button to confirm. What is causing this to happen?
UPDATE
This is what I mean:

How can Vim stop responding?

With an intention to increment a number in a line in Vim, I pressed Ctrl+A. To my wonder Vim stopped responding! Later I realized that I had actually pressed Ctrl+S.
Can somebody please explain this behavior?
I've made some changes to the file, but not saved before vim stopped responding.
(Aside: Ctrl+X decreases the next number on the line)
You've stopped the terminal with CTRL-S. To resume, press CTRL-Q.
Btw, this is not VIM-specific, but rather terminal-specific.
To disable the Ctrl-S/ Ctrl-Q completely from your terminal, add the following line to your .bashrc :
stty -ixon

Resources