VIM - How to map Shift-Enter

后端 未结 5 1771
广开言路
广开言路 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 16:53

    I managed to correct my terminal key-code for Shift+Enter by sending the key-code Vim apparently expects. Depending on your terminal, (Adding Ctrl+Enter as a bonus!)

    iTerm2

    For a single Profile open PreferencesProfilesKeys[+] (Add)
    For all profiles open PreferencesKeys[+] (Add)

    • Keyboard shortcut: (Hit Shift+Enter)
    • Action: Send Escape Sequence
    • Esc+ [13;2u

      Repeat for Ctrl+Enter, with sequence: [13;5u

    urxvt, append to your .Xresources file:

    URxvt.keysym.S-Return:     \033[13;2u
    URxvt.keysym.C-Return:     \033[13;5u
    

    Alacritty, under key_bindings, add following to your ~/.config/alacritty/alacritty.yml:

    - { key: Return,   mods: Shift,   chars: "\x1b[13;2u" }
    - { key: Return,   mods: Control, chars: "\x1b[13;5u" }
    

    Kitty, in ~/.config/kitty/kitty.conf:

    map shift+enter send_text all \x1b[13;2u
    map ctrl+enter send_text all \x1b[13;5u
    

提交回复
热议问题