What's the meaning of 'inoremap' in vimrc

后端 未结 3 1264
清歌不尽
清歌不尽 2020-12-24 13:14

There is a line below in vimrc example file

inoremap Ctrl-u Ctrl-G u Ctrl-u

What\'s the meaning of inoremap and w

3条回答
  •  难免孤独
    2020-12-24 13:47

    For more on why the command has such a bizarre name see this excellent description between the difference between map and noremap. Really good to know!

    To summarise that article, here's a choice quote:

    One downside of the *map commands is the danger of recursing...

    Vim offers another set of mapping commands that will not take mappings into account when they perform their actions.

    So noremap came about to avoid horrible recursion of mappings like

    :nmap dd Ojddk
    

    where the dd in the right-hand side of the map recurses back to the left-hand side definition of the map, and Vim gets stuck in an infinite loop!

提交回复
热议问题