VIM - How to map Shift-Enter

后端 未结 5 1789
广开言路
广开言路 2020-11-27 16:30

I am trying to customize behaviour of Enter key in Normal mode in VIM. Here is my .vimrc:

nmap  o         


        
5条回答
  •  情书的邮戳
    2020-11-27 17:05

    Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today in the terminal version of Vim ( should work in GVIM on all platforms, and in the Windows console Vim). This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

    Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

    But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.


    Note on mapping :

    If you map in normal mode, it'll interfere with selection of history items in the command-line window and with jumping to error under cursor in quickfix/location list windows! (Unless you add the following:)

    :autocmd CmdwinEnter * nnoremap  
    :autocmd BufReadPost quickfix nnoremap  
    

    Note on :nmap:

    You should use :noremap; it makes the mapping immune to remapping and recursion.

提交回复
热议问题