如何映射 Shift-Enter

2023-12-08

我正在尝试自定义的行为Enter key in NormalVim 中的模式。 这是我的.vimrc:

nmap <CR> o<Esc>
nmap <S-CR> i<CR><Esc>

我试图让 Enter 在按下时在当前行后简单地附加一个换行符。然而,当Shift-Enter按下组合键,我想在光标处中断当前行。

后者不起作用。每当我按下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

对于单个配置文件打开优先ProfilesKeys[+](添加)
对于所有打开的配置文件优先Keys[+](添加)

  • Keyboard shortcut: (Hit Shift+Enter)

  • Action: 发送转义序列

  • Esc+ [13;2u

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

urxvt,附加到您的.Xresources file:

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

阿拉克里蒂, under key_bindings,将以下内容添加到您的~/.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

Windows 终端

将这些添加到 JSON 配置的 actions 数组中(通过设置):

        {
            "keys": "shift+enter",
            "command": { "action": "sendInput", "input": "\u001b[13;2u" }
        },
        {
            "keys": "ctrl+enter",
            "command": { "action": "sendInput", "input": "\u001b[13;5u" }
        }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何映射 Shift-Enter 的相关文章

随机推荐