You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.2 KiB

1 year ago
  1. ---
  2. title: "Interception Vimproved"
  3. date: 2023-09-18T11:23:17+05:30
  4. weight: 10
  5. description: "Setting up Interception Vimproved on Debian Bookworm GNU/Linux"
  6. tags: ["vim", "interception-tools", " gnu/linux" , "gnu","keyboard"]
  7. draft: true
  8. type: post
  9. ---
  10. ## Setting up Interception Vimproved on Debian Bookworm
  11. I started learning vim few months ago and wanted to vim key bindings like shortcuts on my laptop after trying a mechanical hackable keyboard.
  12. This blog post shows how to setup interception-vimproved using interception-tools on Debian Bookworm.
  13. Step 1: Install the dependencies to build interception-vimproved on Debian Bookworm GNU/Linux
  14. ```
  15. $ sudo apt install interception-tools meson libyaml-cpp-dev cmake
  16. ```
  17. interception-tools is a small set of tools for input events of devices,that can be used to customize the behaviour of input keyboard mappings.
  18. The advantage of interception-tools operates at lower level compared to xmodmap by using libevdev and libudev.
  19. Step 2: Clone interception-vimproved repository and build
  20. ```
  21. $ git clone "https://github.com/maricn/interception-vimproved"
  22. $ cd interception-vimproved
  23. $ sudo make install
  24. ```
  25. Step 3: Create a file called udevmon.yaml in /etc/interception and paste the following contents into the file /etc/interception/udevmon.yaml
  26. ```
  27. - JOB: "interception -g $DEVNODE | interception-vimproved /etc/interception-vimproved/config.yaml | uinput -d $DEVNODE"
  28. DEVICE:
  29. NAME: ".*((k|K)(eyboard|EYBOARD)|TADA68).*"
  30. ```
  31. Step 4: Reload udevmon using systemctl
  32. ```
  33. $ sudo systemctl restart udevmon
  34. ```
  35. To change any keybindings or to add new mappings the config file is present in config.yaml located in /etc/interception-vimproved/
  36. my config.yaml has the below shortcuts
  37. ```
  38. - intercept: KEY_CAPSLOCK
  39. ontap: KEY_ESC
  40. onhold: KEY_LEFTCTRL
  41. - intercept: KEY_ENTER
  42. # not necessary: ontap: KEY_ENTER is inferred if left empty
  43. onhold: KEY_RIGHTCTRL
  44. # this is a layer. hold space (onhold) contains several remappings
  45. - intercept: KEY_SPACE
  46. onhold:
  47. # special chars
  48. - from: KEY_E
  49. to: KEY_ESC
  50. # alternative syntax
  51. - {from: KEY_D, to: KEY_DELETE}
  52. - {from: KEY_B, to: KEY_BACKSPACE}
  53. # vim home row
  54. - {from: KEY_H, to: KEY_LEFT}
  55. - {from: KEY_J, to: KEY_DOWN}
  56. - {from: KEY_K, to: KEY_UP}
  57. - {from: KEY_L, to: KEY_RIGHT}
  58. # vim above home row
  59. - {from: KEY_Y, to: KEY_HOME}
  60. - {from: KEY_U, to: KEY_PAGEDOWN}
  61. - {from: KEY_I, to: KEY_PAGEUP}
  62. - {from: KEY_O, to: KEY_END}
  63. # number row, to F keys
  64. - {from: KEY_1, to: KEY_F1}
  65. - {from: KEY_2, to: KEY_F2}
  66. - {from: KEY_3, to: KEY_F3}
  67. - {from: KEY_4, to: KEY_F4}
  68. - {from: KEY_5, to: KEY_F5}
  69. - {from: KEY_6, to: KEY_F6}
  70. - {from: KEY_7, to: KEY_F7}
  71. - {from: KEY_8, to: KEY_F8}
  72. - {from: KEY_9, to: KEY_F9}
  73. - {from: KEY_0, to: KEY_F10}
  74. - {from: KEY_MINUS, to: KEY_F11}
  75. - {from: KEY_EQUAL, to: KEY_F12}
  76. # xf86 audio
  77. - {from: KEY_M, to: KEY_MUTE}
  78. - {from: KEY_COMMA, to: KEY_VOLUMEDOWN}
  79. - {from: KEY_DOT, to: KEY_VOLUMEUP}
  80. # mouse navigation
  81. - {from: BTN_LEFT, to: BTN_BACK}
  82. - {from: BTN_RIGHT, to: BTN_FORWARD}
  83. ```
  84. Arch has interception-tools already packaged here is the [link](https://wiki.archlinux.org/title/Interception-tools)
  85. ```
  86. :wq
  87. ```