Skip to content

Instantly share code, notes, and snippets.

@saif97
Last active January 15, 2022 18:17
Show Gist options
  • Save saif97/2576aa35293eed63460857481f7c464d to your computer and use it in GitHub Desktop.
Save saif97/2576aa35293eed63460857481f7c464d to your computer and use it in GitHub Desktop.
my Goku configs for Karabiner-elements
;; ! | means mandatory - modifier(s) alone when pressend change behavior
;; # | means optional - modifiers are optional (but atleast one necessary)
;; :!Ca is keycode :a and prefix a with !C
;; C | left_command
;; T | left_control
;; O | left_option
;; S | left_shift
;; F | fn
;; Q | right_command
;; W | right_control
;; E | right_option
;; R | right_shift
;; ## | optional any
;; !! | command + control + optional + shift (hyper)
;; to understand better how modifiers work in karabiner
;; karabiner definition of mandatory and optional
;; https://karabiner-elements.pqrs.org/docs/json/complex-modifications-manipulator-definition/from/modifiers/
;; need to prefix C T O S F with ! or #
;;
;; code for all this:
;; https://github.com/yqrashawn/GokuRakuJoudo/blob/b9b334a187379f9bc8182ad59e2cca2a1789e9c0/src/karabiner_configurator/keys.clj#L68
{:applications {:vim-mode-disabled-application ["^com\\.apple\\.Terminal$"
"^com\\.googlecode\\.iterm2$"
"^co\\.zeit\\.hyperterm$"
"^co\\.zeit\\.hyper$"
"^io\\.alacritty$"
"^net\\.kovidgoyal\\.kitty$"
"^org\\.vim\\."
"^com\\.qvacua\\.VimR$"]}
:profiles {:Default {:default true}}
:simlayers {:vi-mode {:key :spacebar}
:vi-visual-mode {:key :v :condi :!vim-mode-disabled-application}}
:main [{:des "map capslock-> command | "
:rules [[:##caps_lok :command nil {:alone :f15}]]}
{:des "Vi Mode [D as Trigger Key]"
:rules [;; arrow keys
[:##k :down_arrow :vi-mode]
[:##i :up_arrow :vi-mode]
[:##j :left_arrow :vi-mode]
[:##l :right_arrow :vi-mode]
;; delete & backspace
[:##h :delete_forward :vi-mode]
[:##n :delete_or_backspace :vi-mode]
;;
[:##f :left_option :vi-mode]
[:##d :right_shift :vi-mode]
;; home/ end
[:##u :home :vi-mode]
[:##o :end :vi-mode]
;; window tabs
;; [:##slash :caps_lockw :vi-mode]
[:##period :!Ttab :vi-mode]
[:##comma :!TStab :vi-mode]
[:##m :!CSd :vi-mode]]}
{:des "right shift once -> f15 command pallet in vs code"
:rules [[:##right_shift :right_shift nil {:alone :f16}]]}
{:des "left shift once -> alfred"
:rules [[:##left_shift :left_shift nil {:alone :!Sf15}]]}
{:des "Vi Visual Mode"
:rules [[:##j :!Sdown_arrow :vi-visual-mode]
[:##k :!Sup_arrow :vi-visual-mode]
[:##h :!Sleft_arrow :vi-visual-mode]
[:##l :!Sright_arrow :vi-visual-mode]
[:##b :!SOleft_arrow :vi-visual-mode]
[:##w :!SOright_arrow :vi-visual-mode]
[:##0 :!SCleft_arrow :vi-visual-mode]
[:##4 :!SCright_arrow :vi-visual-mode]
[:##open_bracket :!SOup_arrow :vi-visual-mode]
[:##close_bracket :!SOdown_arrow :vi-visual-mode]]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment