With vim mode enabled in RStudio you need to press the escape key twice to exit insert mode. The reason seems to be that the first key press cancels the completion/info popup. A second key press is therefore necessary to exit insert mode.
I like the automatic popups but it is annoying to press the escape key twice. Is there a way to use a single escape key press only to enter normal mode?
Related
Any keystroke (except for Esc) puts vim into insert mode and inserts the character. Example: I sit in Normal mode, press k to go up, vim goes into insert mode and types k under the cursor. Same for : and other keys. Esc or Ctrl-[ returns to Normal mode, but the behavior persists.
This doesn't happen on entering vim, but on occasion (quite often) it gets into this mode and stays until I kill the terminal window. It's not global (so if I have another vim instance in another terminal, the state does not propagate) so it's probably not about the input modes / keyboard layouts.
Running a Mac M1 with macOS 12.
What could it be?
Update:
It happens after I hit Delete key in Insert mode (consistently).
I have a binding that exits Insert mode on a key sequence (inoremap saj <esc>l), and typing that exits Insert mode for good after it gets stuck. However, exiting through Esc or Ctrl-[ doesn't work as mentioned above.
I'm using Vim in the zsh shell on OSX.
In the image you can see that I have created a test text on the left side. When I exit insert mode (using Esc), Vim duplicates my text a few times.
You can see my Vim editor when I exited the insert mode on the right side of the image.
Why does Vim do that and how can I prevent it?
Make sure you don't accidentally type a number before entering insert mode.
Like any other action, entering text in insert mode can be repeated by prepending the command with typing a number.
For example, typing 3ihelloEsc from normal mode results in the text hellohellohello entered.
If you're unsure whether you have already typed a number, you can cancel any repetition by typing Esc again before entering insert mode.
I am new to vim and have installed oh-my-vim and learnt these keybindings by googling:
Jump forward by word - w
Jump forward by word - b
Jump to end of sentence - A
Close current file without exiting - bd
Undo is u
Execute shell command with ! (bang)
of these typing Shift + a in Normal mode allows me to jump to end of sentence and also goes into insert mode soon as I start typing after it. I tried out Shift + w and Shift + b and
it also shows similar behaviour of going to insert mode as soon as I start typing after I use that keybinding.
What are the equivalents for these keybindings where I am not using a letter?
Jump to start of sentence - 0
Redo is Ctrl + R
Jump to previous line - ``
Hope I am clear in describing. Thanks!
I'm also a beginner and I am getting used to Vim recently.
Well, regarding your question, to switch from Normal to Insert, you could press:
i to insert (the cursor stays, effectively inserting to the left)
a to append (the cursor jumps after the character you were on)
I to insert from the beginning of the line. This is equivalent to pressing 0 in Normal mode, and then pressing i to enter Insert mode.
A to append to the end of the line. This is equivalent to pressing $ in Normal mode to get to the end of the line, and then pressing a to append in Insert Mode.
For Insert to Normal:
press <Esc> to get to Normal mode.
press <Ctrl-[> to get to Normal mode.
press <Ctrl-O> to temporarily enter Normal mode for one command. Upon execution it will automatically return to Insert mode.
Personally, to shift between Normal mode, I use <Ctrl-[> for consecutive commands in Normal mode and <Ctrl-O> if it's a one time deal. <Esc> is too far for my pinky :)
It's not entirely clear what you are asking. Shift+W and Shift+B do not automatically enter insert mode, instead they go back and forth on WORDS (vs words).
If you want to enter insert mode, just hit i. You could hit wi to insert after a word.
You mention 0, which goes to the beginning of a line. You can hit I (shift+I) to insert at the beginning of a line. Note that this inserts after the initial whitespace on the line, it is the same as hitting ^i. If you want to insert at the very beginning of the line, you'll need to use 0i.
I am trying to figure out what is happening when I press Esc. What I notice is that, if I am in Insert mode Esc will paste the previously entered text. I am using vim 7.2 on a rhel 6 linux server connected via iTerm2
This happens when I press Esc two or more times, pressing Esc once will correctly exit insert mode.
I'm using the delimitMate plugin to get autowrapping quotes. How can I step out of these quotes while in insert mode? Not opposed to key mapping.
While in Insert mode, press Ctrl-o(lowercase) immediately followed by A(uppercase).
You will be taken to end of current line and continue to be in Insert mode.
Hope that helps.
EDIT: In case you wish to step out of the quotes and land immediately to the right of the ending quote: while in Insert mode, press Ctrl-o(lowercase) immediately followed by f"(f followed by quotes) and then the right arrow key. You can assign a key map to this combination.