0

I am new to Fedora and I have installed Fedora-34 couple of days ago. Well, when I used ubuntu, I mapped my Esc to CapsLk in vim using following lines in ~/.vimrc file

au VimEnter * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
au VimLeave * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'

Well, this does Not work in Fedora. I searched this at many sites and derived to a conclusion that Fedora does not have xmodmap and we need to create xkb configuration from xmodmap which is also shown here.

I do not know anything xkb file and I want this mapping just for Vim. How can I achieve this in the easiest way possible?

If it matters, this is my vimrc file and you can find above code at Line 723

ajinzrathod
  • 103
  • 2
  • which DE are you using? If gnome, maybe you could try something along the lines discussed on https://ask.fedoraproject.org/t/looking-for-alternative-for-setxkbmap-in-wayland/3380/2, by using `dconf write...` – Marcelo Avila Jun 22 '21 at 15:35
  • @MarceloAvila This solution has 2 issues. *1*. I want `CapsLk` to work like `Esc` but I do not want `Esc` to work like `CapsLk`. This switches both of them. *2*. I want this key binding only in vim. This is changed globally throughout the system. I have mentioned in question as **I want this mapping just for Vim**. Anyway, thanks for this too. – ajinzrathod Jun 23 '21 at 05:49
  • 1
    I see, so something like `au VimEnter * silent! !gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"` `au VimLeave * silent! !gsettings set org.gnome.desktop.input-sources xkb-options "['']"` will not work, right? – Marcelo Avila Jun 23 '21 at 10:24
  • its not the soution, but I believe this is due to fedora using wayland instead of xorg. can you change it to use xorg? If not, do you know of any way of changing the layout from the command line? If you can change the layout, you could create a simple layout with caps remapped to escape. – Marcelo Avila Jun 23 '21 at 10:27
  • Sorry I have not done this ever before. I have no idea about layouts. – ajinzrathod Jun 24 '21 at 09:59
  • No worries. I dont use fedora, so I am probably also not the best to help out, in any case, if you set XOrg instead of Wayland as the windowing system, I strongly believe that the `xmodmap` as stated in your question commands will work. Here is a short tutorial on how to change the windowing system: https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/. – Marcelo Avila Jun 24 '21 at 11:53
  • Thhaank you :-) – ajinzrathod Jun 25 '21 at 09:37

0 Answers0