I'm having some problems remapping my home key; it works when I run Vim from tmux but not when I run it from a regular xterm without tmux. It looks like they're sending different escape codes and Vim only picks up on tmux's one for some reason.
I tried mucking about with a lot of TERM
values, to no avail. So I figured I'd just hard-code this escape code in my vimrc and move on:
set nocompatible
" `^[` is the escape character.
set <Home>=^[OH
set t_kh=^[OH
echo &t_kh
noremap <Home> :echoerr "home!"<CR>
Starting with $ vim -u vimrc
Vim outputs ^[OH
, which is expected. But after I've started Vim the setting seems to be not set:
:set t_kh?
E846: Key code not set: t_kh?
:verbose set t_kh?
E846: Key code not set: t_kh?
And the remapped home key doesn't work. Manually running :set <Home>
or :set t_kh
fixes the problem; I can now use my custom <Home>
mapping.
Why aren't these options taking effect? How can I make them take effect?
I have no plugins and am using Vim 8.0.586 on Arch Linux.
'term'
after your vimrc is loaded?:verbose set term?
just givesterm=xterm-256color
without extra information. Also tried without plugins/vimrc, and I get exactly the same results.:scriptnames