vim-rsi icon indicating copy to clipboard operation
vim-rsi copied to clipboard

Meta mappings not working when $TERM is not xterm

Open pablox-cl opened this issue 9 years ago • 2 comments

While I see vim-rsi is correctly mapping <M-d>:

:verbose imap <m-d>
i  ä           * <C-O>dw
        Last set from ~/.vim/.cache/neobundle/vim-rsi/plugin/rsi.vim

My $TERM/terminfo(?), prints ALT + D as ^]d, unsurprisingly typing the ä, results in the desired command. When running vim from an xterm, it correctly(?), maps ALT + D as ä.

It seems every other terminal emulator (rxvt, and almost everyone [if not all] based on the vte gtk widget) maps ALT + D as ^]d. Though, setting <M-d> as <esc>d, partially solves the problem:

execute "set <M-d>=\ed"
" I tried using \<Esc>, but it's too fast(?) and exists insert mode and let you in operator pending after inserting a `d`.

If I understand correctly, problem with that is that you use <M-d> fast enough (below ttimeoutlen?) the command gets executed as two: ^[, and d and you get out of insert mode and d is inserted in normal mode.

Anyway, I think a plausible workaround could be checking the term, and in case is not xterm, run that line. If you are interested I can do a PR.

pablox-cl avatar Dec 29 '14 01:12 pablox-cl