The goal is to remap CapsLock to Esc in Vim, installed on Ubuntu (console only, no Desktop Environment).
This Ubuntu system is installed on Virtual Private Server. I'm logging to this server using Putty, from my home laptop with Windows 10.
And everybody are talking about mapping this CapsLock key to Esc in Vim, but I was unable to find actual line, that needs 2 be written in $HOME/.vimrc file.
This is what I've tried myself, but none of this works, except for the first line adding row numbers:
set number
inoremap <Caps> <Esc>
inoremap <Caps_Lock> <Esc>
inoremap <CapsLock> <Esc>
The goal is to remap CapsLock to Esc only in Vim, not the whole Ubuntu server.
I've checked and CapsLock works fine in Vim, and makes UpperCase when locked.
I've searched so many places like: https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-Tutorial(Part_1) all 3 parts of this guide and here as well.
Like everything is written there: mapping "ii", "jj", "jk", "jw" different Ctrl and Shift combinations. Everything except CapsLock to Esc remap.
??? Why ???
Why is it so hard to remap CapsLock to Esc in Vim? It's almost my question, but unfortunately on Windows OS.
From the comments below my question I gather that mapping CapsLock to Esc is impossible in Vim alone.
I've also read this thread: How to use CapsLock instead of Escape in Vim?
And the answer that's accepted states: "For remapping in the console, if your distro uses systemd
, you can use a custom keyboard layout in /etc/vconsole.conf
as described on the Arch Wiki."
I guess Ubuntu uses systemd
, so I'm ready to accept the answer that's going to map CapsLock to Esc key in whole Ubuntu installed on my VPS, providing my home, Windows machine key mappings, remain unchanged.
I've run this:
michal@localhost:~$ localectl status
System Locale: LANG=en_US.UTF-8
VC Keymap: n/a
X11 Layout: us
X11 Model: pc105
What should I do next?
I think I don't have this file /etc/vconsole.conf
on my Ubuntu VPS.
Should I create it myself, or should it be there by default?