Miscellaneous

page in development...

Application Config

Ghostty

Partial config snippet to add to your Ghostty config file (located at ~/.config/ghostty/config by default).


# sends ESC d, which Zsh/Bash typically interpret as kill-word (delete next word).
keybind = alt+delete=esc:d

iTerm2

These custom key mappings will allow movements using arrow keys in conjunction with modifier keys. The following JSON can be added to your iTerm2 key bindings under Settings → Keys → Key Bindings → Presets... → Import...

  {"Key Mappings":{"0xf702-0x320000-0x7b":{"Version":0,"Action":47,"Text":"2","Label":""},"0xf703-0x280000-0x0":{"Version":0,"Action":10,"Text":"f","Label":""},"0x7a-0x100000-0x6":{"Version":0,"Action":11,"Text":"0x1f","Label":""},"0xf703-0x2a0000-0x7c":{"Version":0,"Action":46,"Text":"1","Label":""},"0x5a-0x120000-0x6":{"Version":0,"Action":11,"Text":"0x18 0x1f","Label":""},"0xf700-0x300000-0x0":{"Version":0,"Action":7,"Text":"","Label":""},"0xf702-0x2a0000-0x7b":{"Version":0,"Action":47,"Text":"1","Label":""},"0x9-0x40000-0x0":{"Version":0,"Action":25,"Text":"Select Next Tab
Select Next Tab","Label":""},"0x7f-0x100000-0x33":{"Version":0,"Action":11,"Text":"0x15","Label":""},"0xf72d-0x100000-0x0":{"Version":0,"Action":8,"Text":"","Label":""},"0xf702-0x280000-0x0":{"Version":0,"Action":10,"Text":"b","Label":""},"0xf72b-0x100000-0x0":{"Version":0,"Action":4,"Text":"","Label":""},"0x74-0x100000-0x0":{"Version":0,"Action":25,"Text":"New Tab with Current Profile","Label":""},"0x54-0x120000-0x0":{"Version":0,"Action":25,"Text":"Split Vertically with Current Profile
Split Vertically with Current Profile","Label":""},"0xf703-0x300000-0x0":{"Version":0,"Action":11,"Text":"0x05","Label":""},"0x19-0x60000-0x0":{"Version":0,"Action":25,"Text":"Select Previous Tab
Select Previous Tab","Label":""},"0xf703-0x320000-0x0":{"Version":0,"Action":46,"Text":"2","Label":""},"0xf72c-0x20000-0x0":{"Version":0,"Action":9,"Text":"","Label":""},"0xf72d-0x20000-0x0":{"Version":0,"Action":8,"Text":"","Label":""},"0xf703-0x220000-0x7c":{"Version":0,"Action":46,"Text":"0","Label":""},"0x7f-0x80000-0x33":{"Version":0,"Action":11,"Text":"0x17","Label":""},"0xf729-0x100000-0x0":{"Version":0,"Action":5,"Text":"","Label":""},"0xf72c-0x100000-0x0":{"Version":0,"Action":9,"Text":"","Label":""},"0xf702-0x300000-0x7b":{"Version":0,"Action":11,"Text":"0x01","Label":""},"0xf701-0x300000-0x0":{"Version":0,"Action":6,"Text":"","Label":""},"0xf728-0x80000-0x75":{"Version":0,"Action":11,"Text":"0x1b 0x64","Label":""},"0xf702-0x220000-0x7b":{"Version":0,"Action":47,"Text":"0","Label":""}},"Touch Bar Items":{}}

Hammerspoon

Partial config snippet to add to your Hammerspoon initialization file (located at ~/.hammerspoon/init.lua by default). Used in conjunction with Karabiner-Elements to detect lock screen.


local karabinerLog = hs.logger.new("karabinerSync", "info")

local KARABINER_CLI = "/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli"

-- Push a variable into Karabiner-Elements so complex modification rules
-- can react to it via variable_if / variable_unless conditions.
local function setKarabinerVariable(name, value)
  local json = string.format('{"%s": %d}', name, value)

  local task = hs.task.new(KARABINER_CLI, function(exitCode, _, stdErr)
    if exitCode ~= 0 then
      karabinerLog.ef("karabiner_cli failed (%d): %s", exitCode, stdErr)
    end
  end, { "--set-variables-from-stdin" })

  task:setInput(json)
  task:start()
end

-- Keep Karabiner's `is_lock_screen` variable in sync with the real lock state,
-- since Karabiner has no native way to detect this itself.
local screenWatcher = hs.caffeinate.watcher.new(function(eventType)
  if eventType == hs.caffeinate.watcher.screensDidLock then
    setKarabinerVariable("is_lock_screen", 1)
  elseif eventType == hs.caffeinate.watcher.screensDidUnlock then
    setKarabinerVariable("is_lock_screen", 0)
  end
end)

screenWatcher:start()

Automator

Use the following AppleScript Quick Action to toggle Dark Mode on macOS; created via Automator. This service can be assigned a keyboard shortcut (ctrl+opt+cmd+D for Serenity QMK Hardware Layer) in System Settings.


on run {input, parameters}
	tell application "System Events"
		tell appearance preferences
			set dark mode to not dark mode
		end tell
	end tell

	return input
end run

Reference

Vim-less

Thinking of quitting Vim? Here is an indicative reference for performing common Vim-like motions/commands by effortlessly using standard keybindings (primarily made possible with QMK due to Mod and Arrow key availability on the home row). These shortcuts are application-agnostic and eliminate the need for a modal editor for most tasks, or, at a minimum reduce the reliance of using Normal Mode, allowing you to remain in Insert Mode more often than not.

Do the followingBy pressingWhich is similar to this in Vim
Move←, ↓, ↑, →h, j, k, l
Move to beginning of line (soft)⌘ ← (or home)^
Move to beginning of line (hard)⌘ ← ← (or home twice)0
Move to end of line⌘ → (or end)$
Jump to beginning of document⌘ ↑gg
Jump to end of document⌘ ↓G
Page upPage Up key (Num/Nav layer)⌃ b
Page downPage Down key (Num/Nav layer)⌃ f
Delete previous character⌫X
Delete character⌦x
UndoUndo key (Num/Nav layer)u
CutCut key (Num/Nav layer)d
CopyCopy key (Num/Nav layer)y
PastePaste key (Num/Nav layer)p
RedoRedo key (Num/Nav layer)⌃ r
Move to start word⌥ ←b
Move to end word⌥ →e
Delete start word⌥ ⌫db
Delete end word⌥ ⌦de
Delete start line⌘ ⌫d0
Delete end line⌘ ⌦D
Selection (Visual mode)⇧ (use other movement shortcuts while holding shift, often in conjunction with arrow keys, to expand or shrink selection)v
Select cursor wordWord Select key (Num/Nav layer, tap)viw
Select cursor lineLine Select key (Num/Nav layer, long press)V
Indent⇥>
Un-indent⇤<

Some of the other commands and movements not covered by the basic movements can often be implemented in modern text editors via extensions or built-in functionality. Here are a couple of VSCode Extensions I maintain to fill in some functionality gaps so to speak.

Get In Touch

Have questions, comments, or feedback? Feel free to reach out anytime at majority-myth-cube@duck.com