The feature that makes key combinations such as the ones you mentioned is called modifyOtherKeys
and it's provided by some terminals like xterm. It lets Vim distinguish various keys, like <C-i>
from <Tab>
, which used to be impossible.
Support for this feature was first introduced in Vim 8.1.2134, and the feature was enabled by default in version 8.1.2194. Starting from this version, when Vim thinks it's running in xterm (which it decides based on $TERM
being xterm
or xterm-256color
or similar), Vim automatically sends the terminal a special sequence to enable the feature and request that the terminal start sending extended key codes which allow Vim to differentiate keys and capture all modifiers.
Ubuntu 20.04 LTS ships Vim 8.0.1453, which predates the introduction of this feature. So that explains why you had trouble getting it to work, even when setting the $TERM
variable appropriately. (You probably got it to work in NeoVim since you got a recent version of NeoVim installed, which included the feature, so that part has a pretty plausible explanation too.)
My recommendation is that you upgrade the Vim package in your Ubuntu machine to a newer version. The easiest way to do so is to add a PPA which includes newer builds of the Vim package to your host. Luckily, there's a well maintained PPA with such Vim packages. In order to add it to your box, use the following commands:
$ sudo add-apt-repository ppa:jonathonf/vim
$ sudo apt-get update
And then you can use apt-get upgrade
or similar to upgrade the Vim packages to the latest ones available from the PPA (version 8.2.2815 as of April 2021.)
:nnoremap <C-Home> :echo "C-Home"<CR>
worked fine)alacritty 0.8.0-dev
:nnoremap <C-End> :echo 'hello'<CR>
works in neovim but not in vim (not sure how to fix tho maybe you'll need to mess witht_kh
? ¯\_(ツ)_/¯)