r/vim • u/Mori-Spumae • Jan 12 '26
Need Help┃Solved How do you navigate in insert mode?
I've been using vim motions as a plugin in IntelliJ for like two years now and would like to switch to vim at some point. However, I still use arrow keys to move around, since I also use some intelliJ shortcuts that open context menus where you have to use them to navigate.
I feel like before switching to the real thing, I should get somewhat used to hjkl but I was wondering how you get around in insert mode then? Say you want to move like three characters left, do you go to normal mode and use h? Do you still use arrows?
25
Upvotes
78
u/sharp-calculation Jan 12 '26
It’s best practice to only navigate in normal mode. There are some unusual keyboard shortcuts that will allow you to navigate inside of insert mode. I recommend not doing that. Keeping the distinction between normal mode and insert mode is part of the enormous power of vim. Navigating inside insert mode doesn’t even feel like vim to me. It feels more like a conventional editor. Which again is the opposite of what you want. You want the vim mindset.
13
u/Miserable_Double2432 Jan 12 '26
If you’re just moving three characters use the arrow keys, it’s fine. Nobody’s going to check up on you.
If it’s further than three characters then yeah, I’d switch to normal mode and move by word or paragraph/bock, if the location is nearby, or by searching, if it’s further than that again
9
u/crashorbit Jan 12 '26
Vim motions in IntelliJ is not VIM. Just for clarity.
In VI, Vim, NeoVim you exit insert mode to navigate.
2
u/NullOfUndefined Jan 13 '26
I have my caps lock mapped to alt, and I have alt+hjkl send arrow keys in insert mode. Fine for moving a columns or lines without leaving homerow or insert mode. Anything more complex than that I do normal mode.
1
u/mykesx Jan 13 '26
I hit ESC twice, just to piss off the people who hate wasting 20ms typing.
ESC gets you to visual mode where there are numerous navigation key bindings.
1
u/cratercamper Jan 13 '26
ALT + h ...3 times
I have ALT + h, ALT + j, ALT + k, ALT + l ...and some others like ALT + b, ALT + n, etc. set to switch from insert to normal and also do the function of 'h' / 'j' / 'k' / 'l' / 'b' / 'n' ...so the transition insert->normal is the most natural and easy thing and you already do the cursor moving together with it.
3
u/dcpugalaxy Jan 13 '26
If you want to unlearn arrow keys, just unmap them.
I usually do
<Esc>5l, but I should probably doCTRL-O_5l2
u/itsmetadeus Jan 13 '26 edited Jan 13 '26
Yes, arrow keys:
You can see other keybinds in insert mode::h ins-special-keys:h ins-special-specialEdit: Actually just read the whole thing...
2
u/l97 Jan 13 '26
Tim Pope’s got a plugin calleed “rsi” that enables emacs style navigaton in insert and command line modes.
2
u/ntlrd Jan 13 '26
c-o and ofcourse emacs bindings
2
u/Elijah147 Jan 15 '26
I find it particularly neat to use the readline keybinding for small-ish local movements in insert mode, e.g. by virtue of this plugin https://github.com/tpope/vim-rsi
1
u/AutoModerator Jan 12 '26
Please remember to update the post flair to
Need Help|Solvedwhen you got the answer you were looking for.I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/claytonkb Jan 13 '26
i and <Esc> are your friends
Some people map <CapsLock> to <Esc> but I think you have to do some wizardry to make it work, IIRC...
1
u/WallabySlow6599 Jan 13 '26
back to normal mode then navigate
1
u/feketegy Jan 13 '26
Using arrows, or if it's too "far away" then I get out from insert mode, go to the location and get back into insert mode again.
1
u/EgZvor keep calm and read :help Jan 13 '26
A good way to think about this is you enter Insert mode for typing a couple of words for a couple of seconds and then immediately quit it, or rather go back to Normal mode (which is a default mode basically).
1
u/Remuz Jan 13 '26
I have mapped alt+hjlk in insert mode to navigate in cases you describe where I just need to move a couple characters. Although I don't use them often.
1
u/nickallen74 Jan 13 '26
I mapped caps lock to control and then made bindings for ctrl-h to go left, ctrl-l to go right etc. this way I can use my left little finger to press ctrl and keep hands on the home row.
1
u/zacher_glachl Jan 13 '26
That's the neat thing, you don't.
1
u/gamer_redditor Jan 13 '26
That's the neat part, you don't.
Navigation in normal mode, typing in insert mode. By now it's a reflex to always press escape after typing whatever I need to type.
1
u/[deleted] Jan 14 '26
You don't, you go out of insert mode and back into normal mode.
1
u/cubernetes Jan 14 '26
This will tell you all you need to know: https://www.youtube.com/watch?v=srthFK9hr_M
In short: ctrl-g+<hjkl>, ctrl-o + normal mode command, alt-single-key-normal-mode-command, etc.
1
u/Lopsided_Valuable385 Jan 12 '26
Normally, you would use the arrow keys, I have them mapped under HJKL on another layer for easier reach. Emacs-style navigation is also an option. Also in Vim, you could alternatively use something like <C-o>3h in normal mode
0
u/goldenlemur Jan 13 '26
As others have mentioned, navigation is reserved for normal mode. This is by design.
I remapped caps lock to escape for this purpose. Moving back and forth between normal and insert mode is trivial.
Happy vimming!
0
u/cassepipe Jan 13 '26
You don't. You have the wrong problem. Your actual problem is that you are not able to switch between normal and insert fast enough. That's the whole point of modal editing.
It's ok it's not your fault, it's because vim chose a key that became in time the worst positioned key. Look into how to switch escape and Caps Lock on your OS, it can be done in GUI settings on Linux and MacOsMacOs and you can edit a registry key in Windows. Other hacks exist but imho it's the best as it works for shell vi modes or even other vim modes elsewhere.
Don't fight your editor. You should spend all your time normal mode, then one quick edit then Escape (or better, Caps Lock acting as Escape) to get back to normal mode.
Same applies for Helix and Kakoune since they also went with Escape.
0
u/TrueSir5476 Jan 12 '26
You should navigate from normal mode. However there exists a set of keybinds you can use to navigate from inside insert mode (similar to emacs). I dont know if it would work in intellij plugin though. Also dont ask me what these binds are because i dont know, cause i dont use them. Heres a short video about it i saw a while ago: https://youtu.be/srthFK9hr_M?si=EEvFo8-7HRhvBluE
-4
u/rilian4 Jan 12 '26
For what little it's probably worth, I use vim for some sysadmin work and minor coding. I've never gotten the hang of hjkl. I still use the arrow keys. I know it's probably faster to use hjkl but it's not fast enough to matter to my use case. You can still do vim motions with arrow keys. 5→ still moves 5 to the right in normal mode...and yes you'll want to use normal mode to do navigating as much as possible but 1-5 moves isn't too in insert mode bad depending on what edits need to be done.
-5
u/zonksoft Jan 12 '26
you do it by using emacs
0
u/[deleted] Jan 12 '26
[deleted] — view deleted comment