LINUX.ORG.RU

История изменений

Исправление science, (текущая версия) :

Нашел интересный вариант решения проблемы:

you can still make the desired combination work if your terminal application has the ability to remap key combinations (as iTerm2, for example, does). Map the terminal application's combination to some Unicode character you'll never use, then map that key in Vim to the desired effect, and you can get around this limitation.

For this example, in iTerm2, open the Keys Preferences pane, add a Global Shortcut key, input shift and return, give it an action of Set Text, and then put ✠ (a Maltese Cross, but you could use any random unlikely-to-be-used Unicode character) as its value. In your .vimrc, add these lines:

" Map ✠ (U+2720) to <Esc> as <S-CR> is mapped to ✠ in iTerm2.
inoremap ✠ <Esc>

Or:

inoremap <S-CR> <Esc>
" Map ✠ (U+2720) to <S-CR>, so we have <S-CR> mapped to ✠ in iTerm2 and
" ✠ mapped back to <S-CR> in Vim. 
imap ✠ <S-CR>

Entering <S-CR> in Vim in iTerm2 will now ultimately result in <Esc> in Vim as desired.

Т.е. ход конём, ремапим в самом терминале срабатывание произвольного неиспользуемого обычно кода нажатия на <S-CR> - и на него уже вешаем в самом виме <S-CR>

Но я пока-что не нашел более менее годный терминал с возможностью произвольного ремапинга и кастомизации. Кажется urxvt/xterm так умеют, но они мне не подходят.

Я обычно использую x11-terms/terminal, sakura, lilyterm

Исходная версия science, :

Нашел интересный вариант решения проблемы:

you can still make the desired combination work if your terminal application has the ability to remap key combinations (as iTerm2, for example, does). Map the terminal application's combination to some Unicode character you'll never use, then map that key in Vim to the desired effect, and you can get around this limitation.

For this example, in iTerm2, open the Keys Preferences pane, add a Global Shortcut key, input shift and return, give it an action of Set Text, and then put ✠ (a Maltese Cross, but you could use any random unlikely-to-be-used Unicode character) as its value. In your .vimrc, add these lines:

" Map ✠ (U+2720) to <Esc> as <S-CR> is mapped to ✠ in iTerm2.
inoremap ✠ <Esc>

Or:

inoremap <S-CR> <Esc>
" Map ✠ (U+2720) to <S-CR>, so we have <S-CR> mapped to ✠ in iTerm2 and
" ✠ mapped back to <S-CR> in Vim. 
imap ✠ <S-CR>

Entering <S-CR> in Vim in iTerm2 will now ultimately result in <Esc> in Vim as desired.

Т.е. ход конём, ремапим в самом терминале срабатывание произвольного неиспользуемого обычно кода нажатия на <S-CR> - и на него уже вешаем в самом виме <S-CR>

Но я пока-что не нашел более менее годный терминал с возможностью произвольного ремапинга и кастомизации. Кажется urxvt/xterm так умеют, но они мне не подходят.