Matt's MacOS dotfiles
Fish, VS Code, Karabiner, Hammerspoon, FZF, git aliases, git helpers (fclone/fhub).
Goals here: https://mattorb.com/dotfiles/
git clone http://github.com/mattorb/dotfiles && cd dotfiles && ./setup.sh
or w/o git: `
curl -sL https://github.com/mattorb/dotfiles/archive/master.tar.gz | tar xz && cd dotfiles-master && ./setup.sh
The Hyper Key
Using Karabiner, the right-command key is remapped to be a new meta key, called the hyper key.
The hyper key is mapped to trigger command+ctrl+alt+shift when pressed. We leverage that for defining new global keyboard shortcuts because it has a very low chance of having application level key binding conflicts, so it is a clean slate of slots to bind behaviors on.
MenuHammer and Launching Applications
MenuHammer enables a custom menu accessible from anywhere via hyper+space. Many helpful actions, such as toggling wi-fi, executing a favorite script, or launching an application are only an alpha keypress or two away.
hyper+space Show Top Menu
hyper+a Show Applications Menu
hyper+f Show Finder Menu
Each of these takes a couple of key presses to navigate.
Heavily used applications are bound to a dedicated hotkey which has a good pnemonic:
hyper+t Launches Terminal
hyper+s Launches Slack
-- courtesy of JR
Press hyper+W for Window Management
It pops up a cheatsheet of window resize/move commands, re-using h,j,k, or l for moving and resizing a window to left half, bottom half, top half, and right half of the screen.
i, o,,, and . move and resize to the top left, top right, bottom left, and bottom right, respectively.
Super Duper mode
-- courtesy of JR
Using Hammerspoon, we enable the simultaneous press of s+d to activate a mode which temporarily changes the function of other keys on the home row.
With the left hand, press and hold s+d to enter super duper mode. Then use the right hand to press h,j,k, or l for moving the cursor left, down, up, or right. Additionally, you can add a for alt, f of command, and space for shift using the left hand.
This is mostly following what Jason implemented here, so please refer to that for more explanation and detail.
The cursor movement/navigation part of this is especially useful on a laptop keyboard, but also generally better for keeping your hands on the home row. Some of the reasoning and thought behind what I adopted can be found here.
My fork introduces the following key changes from the original:
- In super duper mode, emit 'nudging' mousewheel events with n,m,,,.. Left and right click mouse with b and /.
- In super duper mode, activate application menu with g
- In super duper mode, map y/u/i/o to home/pgdn/pgup/end.
- Adds 'Ah fudge' mode.
Ah Fudge Mode
I added an ah fudge mode analagous to super duper, but focused on tab/window nav. The window navigation goes across all open apps and shows a screenshot preview via Hammerspoon window switcher.
i switches to previous window
o switches to next window
j switch to previous tab
k switch to next tab
u switches to previous app (exactly like pressing cmd+tab once)
m switches to the previous space s , switches to the next spcae
Application level keyboard shortcut helpers
hyper+o to autocomplete search menu items in the current application
hyper+p for a cheatsheet of all menu items and their shortcut keys (courtesy of KSheet hammerspoon spoon)
Key help in the shell (see below)
Fish is my shell of choice for its clean and thoughtful syntax.
One thing I'm trying to get better at is using handy commandline shortcuts on the CLI.
alt+K will show commandline keyboard shortcut help in-line while in the Terminal.
It keeps the cursor in-position in the commandline even after displaying a cheat sheet. This means you can think 'What is that key that does x', press alt+K without losing your spot, see the help and then directly use that key all without leaving the commandline window as illustrated here.
FZF Command line
FZF is a command-line fuzzy finder that enables all sorts of interesting possibilities, including a lot of the features bound to keys in the Shell Enhancements section above.
I'm using it for numerous things like replacing history search, dir/file tab completion, and to drive some other situations where one or more items needs to be selected from a list.
ctrl+R search history w/fzf+preview
ctrl+F inserts a file path (starts from token under by cursor)
alt+O changes into subdirectories (starts from token by cursor)
ctrl+O open file using default editor
ctrl+G open file using system bound app (pdf/img/etc)
Git Aliases and Helpers
Numerous helpful Git Aliases are available, several which integrate with capabilities of fzf.
Screen Recording / Presenting
I'm currently using Gifox for to record animated gifs of terminal sessions, combined with KeyCastr to overlay keypresses, and some custom fish scripts to minimize prompt and window title info. (see prompt_mini/prompt_main/title_empty in fish/functions/)
Inspiration / Credits
I've tried to mention sources when something was derived, but a couple of large influences stand out in what's here: