From 058149656c62a174b9e74854d7252395fdb47f8c Mon Sep 17 00:00:00 2001 From: Florent Nuttens Date: Mon, 7 Oct 2024 18:59:02 +0200 Subject: [PATCH] feat(kanata): add HRM-optimized navigation layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## HRM friendly S-tab/tab S-tab and tab stay on the homerow while playing nice with Ctrl and Alt mods. ## Add cross-platform quit shortcut on HRM nav layer @qut → [Q] - @qut allows closing apps on any OS (C-q on Linux, A-f4 on Windows, etc.), optimizing muscular memory - it is more coherent to map @qut on [Q] @pad → [A] - @pad thus mirrors @fun on the right hand - allows using the numpad’s arrow keys without locking the layer (layer-while-held) ## Map esc/del on [A]/[V] The goal is to allow escaping and deleting using the left hand only. --- README.md | 12 ++ img/vim_hrm_navigation.svg | 248 +++++++++++++++++++++++++ kanata/deflayer/navigation_vim_hrm.kbd | 54 ++++++ kanata/kanata.kbd | 1 + 4 files changed, 315 insertions(+) create mode 100644 img/vim_hrm_navigation.svg create mode 100644 kanata/deflayer/navigation_vim_hrm.kbd diff --git a/README.md b/README.md index 4e65b96..60e0480 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,18 @@ without holding the key until escaped with Alt or AltGr. Fn layer toggled

+##### HRM friendly variant + +The basic `Navigation` layer’s `WASZXCV` shortcuts are useful for some layouts, but they can be seen as a waste of layer space when using Home Row Mods. + +This variant replaces QWERTY shorcuts by the following: +- cross-platform quit shortcut +- HRM optimized `tab` and `S-tab` +- easy to use `escape` and `delete` +- three empty spots for your own keys or layers + +![HRM friendly Vim navigation layer on a 33-key keyboard](./img/vim_hrm_navigation.svg) + ### 5. Keyboard layout Choose your keyboard layout among the available ones for Arsenik to work diff --git a/img/vim_hrm_navigation.svg b/img/vim_hrm_navigation.svg new file mode 100644 index 0000000..8b87e60 --- /dev/null +++ b/img/vim_hrm_navigation.svg @@ -0,0 +1,248 @@ + + + + + + + + + Q + quit + + + + W + + + + + E + + + + + R + + + + + T + + + + + + Y + + + + + U + + + + + I + + + + + O + + + + + P + + + + + + + + + + A + NumPad + + + + S + + + + + D + + + + + F + + + + + G + + + + + + H + + + + + J + + + + + K + + + + + L + + + + + + : + Fn + + + + + + + + + + Z + + + + + + X + + + + + + C + + + + + + V + + + + + + + B + + + + + + + N + 🖰 + + + + + M + 🖰 + + + + + , + < + 🖰 + + + + + . + > + 🖰 + + + + + / + ? + + + + + + + + + + + + nav + + + + + + + + diff --git a/kanata/deflayer/navigation_vim_hrm.kbd b/kanata/deflayer/navigation_vim_hrm.kbd new file mode 100644 index 0000000..8ce5655 --- /dev/null +++ b/kanata/deflayer/navigation_vim_hrm.kbd @@ -0,0 +1,54 @@ +;; Vim-Navigation layer (optimized for home-row mods): +;; - right: Vim-like arrows on HJKL, home/end page up/down, mouse scroll +;; - left: Tab/Shift-Tab, prev/next, quit, esc, del +;; - top: Super-num (i3/sway) or Alt-num (browser), zoom in/out + +;; The `lrld` action stands for "live reload". This will re-parse everything +;; except for linux-dev, i.e. you cannot live reload and switch keyboard devices. + +(deflayer navigation + M-1 M-2 M-3 M-4 M-5 lrld M-6 M-7 M-8 M-9 M-0 + @qut esc bck fwd XX home pgdn pgup end @run + @pad S-tab tab tab XX lft down up rght @fun + XX XX XX del XX _ @mwl @mwd @mwu @mwr XX + del _ esc +) + +;; NumPad +(deflayer numpad + _ _ _ _ _ _ _ _ _ _ _ + XX home up end pgup @/ @7 @8 @9 XX + XX lft down rght pgdn @- @4 @5 @6 @0 + XX XX XX XX XX _ @, @1 @2 @3 @. + @std @nbs @std +) + +;; function keys +(deflayer funpad + XX XX XX XX XX XX XX XX XX XX XX + f1 f2 f3 f4 XX XX XX XX XX XX + f5 f6 f7 f8 XX XX lctl lalt lmet _ + f9 f10 f11 f12 XX XX XX XX XX XX XX + _ _ _ +) + +(defalias + std (layer-switch base) + pad (layer-switch numpad) + + fun (layer-while-held funpad) + + ;; Choose the quit shortcut according to your OS. + ;; qut C-q ;; [Control]-[Q] (Linux) + ;; qut M-q ;; [Command]-[Q] (macOS) + ;; qut A-f4 ;; [Alt]-[F4] (Windows) + qut XX ;; do nothing + + ;; Mouse wheel emulation + mwu (mwheel-up 50 120) + mwd (mwheel-down 50 120) + mwl (mwheel-left 50 120) + mwr (mwheel-right 50 120) +) + +;; vim: set ft=lisp diff --git a/kanata/kanata.kbd b/kanata/kanata.kbd index 705001a..4e3b608 100644 --- a/kanata/kanata.kbd +++ b/kanata/kanata.kbd @@ -59,6 +59,7 @@ (include deflayer/navigation.kbd) ;; ESDF on the left, NumPad on the right ;; (include deflayer/navigation_vim.kbd) ;; HJKL + NumPad on [Space]+[Q] +;; (include deflayer/navigation_vim_hrm.kbd) ;; HJKL + NumPad on [Space]+[A], optimized for home-row mods ;; Replace XX by the keyboard shortcut of your application launcher, if any. ;; Mapped on [Space]+[P] in both navigation layers.