Skip to main content
added 1597 characters in body
Source Link

inI did find the answer but it was split up between sites and I thought that it would be a good idea to unite them in a question aaaaaaaaaaaaaaaaaaa.

Truth is that you can't do this natively in vim, but you need to implement it system-wide. As the capslock key doesn't mean anything on it's own.

How to do this:

  1. Go to this directory /etc/X11/xorg.conf.d/
  2. There you will find a text file named like something like 90-custom-kbd.conf (this may vary, in my case it was preceded by a 00 instead of a 90)
  3. Enter the file with vim and write the following
#keybind capslock as esc

Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"

    Option "XKbOptions" "caps:escape"
EndSection

6.in order to save it you need to enter vim normal mode and write :w !sudo tee %

  • w writes the buffer,
  • !sudo calls the shell with sudo,
  • tee redirects the output of vim :w to the output with tee, and
  • % is the current filename

Enter the sudo password and press L

  1. Reboot the computer

if you still wish to use the capslock key you can by in the line before the EndSection where it says caps:escape type caps:escape_shifted_capslock

In order to use it you will need to press the shift key

Sources:

in the question aaaaaaaaaaaaaaaaaaa

I did find the answer but it was split up between sites and I thought that it would be a good idea to unite them in a question.

Truth is that you can't do this natively in vim, but you need to implement it system-wide. As the capslock key doesn't mean anything on it's own.

How to do this:

  1. Go to this directory /etc/X11/xorg.conf.d/
  2. There you will find a text file named like something like 90-custom-kbd.conf (this may vary, in my case it was preceded by a 00 instead of a 90)
  3. Enter the file with vim and write the following
#keybind capslock as esc

Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"

    Option "XKbOptions" "caps:escape"
EndSection

6.in order to save it you need to enter vim normal mode and write :w !sudo tee %

  • w writes the buffer,
  • !sudo calls the shell with sudo,
  • tee redirects the output of vim :w to the output with tee, and
  • % is the current filename

Enter the sudo password and press L

  1. Reboot the computer

if you still wish to use the capslock key you can by in the line before the EndSection where it says caps:escape type caps:escape_shifted_capslock

In order to use it you will need to press the shift key

Sources:

Source Link

in the question aaaaaaaaaaaaaaaaaaa