Skip to content

mattorb/dotfiles

Repository files navigation

Github Action Build Status Azure DevOps Build Status

Matt's MacOS dotfiles

Fish, VS Code, Hammerspoon, FZF, git aliases, git helpers (fclone/fhub).

Goals here: https://mattorb.com/dotfiles/

Install

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

Window Management

-- courtesy of JR

Press alt+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:

  1. In super duper mode, emit 'nudging' mousewheel events with n,m,,,.. Left and right click mouse with b and /.
  2. In super duper mode, activate application menu with g
  3. In super duper mode, map y/u/i/o to home/pgdn/pgup/end.
  4. 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

Additionally,

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

alt+o to autocomplete search menu items in the current application

alt+p for a cheatsheet of all menu items and their shortcut keys (courtesy of KSheet hammerspoon spoon)

Key help in the shell (see below)

Shell Enhancements

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.

For example:

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)

Tour here

Git Aliases and Helpers

Numerous helpful Git Aliases are available, several which integrate with capabilities of fzf.

Scripts like fstash for managing stashes, fclone, fco for checking out a branch and fhub for cloning from and browsing to available private github repo's.

History of building fhub and fclone here: part 1, part 2

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: