How to map Shift-Enter

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 Preferences
Keys[+] (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

Leave a Comment