modify the sudoers file ($ sudo visudo) and add the following content:
# passwordless sudo for your-user for all commands.
your-user ALL=(ALL) NOPASSWD: ALLnote: this is a lax security policy, and should be implemented judiciously. it's more reasonable to observe the principle of least privilege, which would usually be implemented as only whitelisting the exact commands a given user needs to run with escalated permissions.
system-wide approach - in the /etc/default/keyboard (debian) file, set XKBOPTIONS:
* ="ctrl:swapcaps" (swaps capslock and ctrl).
* ="ctrl:nocaps" (capslock becomes an additional ctrl)
xfce/x session approach - use setxkbmap:
* setxkbmap -option ctrl:swapcaps (swaps capslock and ctrl)
* setxkbmap -option ctrl:nocaps (capslock becomes an additional ctrl)
* to clear all options first: setxkbmap -option
* to make persistent across reboots:
* add to xfce session startup: Settings → Session and Startup → Application Autostart
* or add to ~/.xprofile
Ctrl-[ is a valid escape sequence in at least some (including vi/vim/nvim) terminal applications.