Home  >  Q&A  >  body text

gvim - How to temporarily exit insert mode and enter normal mode in vim?

Just like the title, sometimes when I finish typing the brackets, I need to move the cursor. If I use arrows to move it, it will be farther away from my hand, which is a bit troublesome. But if I press Esc first, I can return to the normal mode. If so, there are many buttons to press. Is there a button that is in normal mode when pressed and in insert mode when raised?

Is there any?

Or is there a way to quickly switch?

PHPzPHPz2712 days ago1131

reply all(5)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 16:41:12

    CTRL+O can temporarily enter normal mode, and it will automatically return to insert mode after pressing a command. I don't know if it meets your requirements.

    reply
    0
  • 阿神

    阿神2017-05-16 16:41:12

    A funny thing I saw a long time ago:

    Aleksandr Levchuk这位老兄可以称得上是Vim文本编辑器的超级粉丝。
    有意思的是,他为了改善Vim的文本编辑速度,竟亲自动手为Vim制作了
    脚踏板离合器。当踩下踏板时,就会让Vim进入插入模式(效果如按i一
    样);如果松开踏板,则会回到Vim的正常模式(就像按了ESC键)。
    

    Github portal: https://github.com/alevchuk/vim-clutch

    //I’m just here for entertainment~

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 16:41:12

    Unfortunately, this is the usage pattern of Vim, just get used to it. Moreover, after pressing Esc回到Normal mode后移动光标有很多命令可以选择,没必要一个一个h,j,k,l地连着按,最简单的,比如15h会回移15个字符,^w会删掉上次个单词,b前移一个单词,等等太多了。你习惯用这些命令后,就会发现按Esc to return to Normal Mode, moving the cursor is much more efficient than moving up, down, left, and right again and again in Insert Mode.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-16 16:41:12

    Add these commands under the configuration file:
    inoremap <C-h> <Left>
    inoremap <C-j> <Down>
    inoremap <C-k>
    inoremap <C- l> <Right>

    That’s it, but it also sacrifices some default functions

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 16:41:12

    Don’t you think it’s emacs? Press ctrl to change the mode~
    It is recommended to map ctrl-f and ctrl-b to move left and right, ctrl-c to <Esc>, it’s okay if you don’t need i_ctrl-c,
    Insert You can think about the ctrl key combination in mode.
    There are useful plug-ins for bracket completion, such as delimitMate, etc.

    reply
    0
  • Cancelreply