What's the meaning of 'inoremap' in vimrc

后端 未结 3 1239
清歌不尽
清歌不尽 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:35

    I also wondered about this. See http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-Tutorial(Part_1)#Insert_mode_maps :

    Insert mode maps

    To map keys that work only in the insert and replace modes, use the 'imap' or 'inoremap' command.

    Example: The following command maps to insert the directory name of the current buffer:

    :inoremap  =expand('%:p:h')
    

    To display the currently defined insert mode maps, use the 'imap' command without any argument:

    :imap
    

    To remove a keymap from insert mode, use the ':iunmap' command. For example, the following command removes the insert mode map for .

    :iunmap 
    

    As printable keys insert a character in the current buffer in insert mode, you should use non-printable keys to create insert mode maps. Some examples for non-printable keys include the function keys , keys prefixed with the Ctrl or Alt key.

    [snip]


    So, for example, in my ~/.vimrc I have

    inoremap jk 
    inoremap jj 
    

    which when pressed in Insert mode return me to Normal mode.

提交回复
热议问题