Skip to content

Subjective/dotfiles

Repository files navigation

Subjective's dotfiles

These are the dotfiles I use on my Mac system, currently running MacOS Ventura. My editor of choice is Neovim, but I also use VSCode occasionally. The instructions are adapted from Joshua Steele's dotfiles repository.

Table of Contents

Prerequisites

The dotfiles assume you are running macOS with the following software pre-installed:

Installation

I'm using a bare git repo with its working tree set to my home directory to manage my dotfiles without symlinks.

  1. Setup your shell. (See Fish/Zsh instructions below.)

  2. Run the following commands in the shell to clone the dotfiles:

$ echo ".cfg" >> $HOME/.gitignore
$ git clone --bare 'https://github.com/Subjective/dotfiles.git' $HOME/.cfg
$ alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
$ dotfiles config --local status.showUntrackedFiles no
$ dotfiles checkout
$ dotfiles sparse-checkout set --no-cone '/*' '!LICENSE'
$ dotfiles config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
$ dotfiles remote update
$ dotfiles branch -u origin/main

Zsh Setup

I recently switched from Oh My Zsh to Zim as my primary Zsh configuration framework/plugin manager. Not only is it much faster, but it also handles automatic installation and updating of custom plugins. If you want to learn more, check out this post.

  1. Install zsh: $ brew install zsh
  2. Install custom plugins: $ zimfw install

Fish Setup

  1. Install fish: $ brew install fish
  2. Install fisher: $ curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
  3. Restart your computer.
  4. Install tide theme: $ fisher install IlanCosman/tide@v5

Post-install Tasks

After cloning the dotfiles repo there are still a couple of things that need to be done.

  • Set up iTerm2 or Kitty profile (see details below).
  • Complete Brew Bundle and install packages with $ brew bundle install
  • Install Rust via Rustup: $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Install neovim via bob: $ cargo install bob-nvim
  • After opening Neovim, run :checkhealth and resolve errors/warnings.
  • If using Fish, customize your setup by running the $ fish_config command.

Setting up iTerm2

  1. Open iTerm2.
  2. Select iTerm2 > Preferences.
  3. Under the General tab, check the box labeled "Load preferences from a custom folder or URL:"
  4. Press "Browse" and point it to ~/.config/iterm2/com.googlecode.iterm2.plist.
  5. Restart iTerm2.

Setting up Kitty

Getting set up after a fresh install is simple.

  1. Tweak preferences in ~/.config/kitty/kitty.conf
  2. Uncomment Alacritty terminfo lines in ~/.tmux.conf
  3. Setup alternative MacOS application icon for Kitty.
  4. Run Kitty!

Setting up yabai and skhd

I use a tiling window manager called yabai to manage my windows and workspaces and the hotkey daemon skhd to customize yabai's keyboard shortcuts. However, in order to enable all of of yabai's features such as border highlights, instant switching between spaces, and window animations, System Integrity Protection (SIP) must be partially disabled.

  1. Partially Disable System Integrity Protection according the yabai docs.
  2. Configure Scripting Addition according to the yabai docs
  3. Start yabai and skhd:
$ yabai --start-service
$ skhd --start-service

Backing up app settings and personal files

Mackup for backup

Mackup is a fantastic tool that allows you to: backup personal application settings and private data; sync that data between computers; and then easily restore your configuration to a fresh install — all in a simple command line interface. Seems good!

While by no means a comprehensive backup solution, Mackup keeps things simple, currently supports over 360 applications and can store data on Dropbox, Google Drive, iCloud or any path you can copy to.

How I use Mackup

I store on iCloud and explicitly declare which apps to sync and which to ignore — anything handled by my dotfiles is ignored (bash, git, vim etc.)

I backup a wide range of other applications including those containing credentials such as aws, gnupg and ssh. It's also possible to backup apps not natively supported using custom .cfg files. For example, to backup Ulysses (an amazing markdown writing app), create a ~/.mackup directory and place a ulysses.cfg file inside:

[application]
name = Ulysses

[configuration_files]
Library/Preferences/com.soulmen.ulysses3.plist
Library/Preferences/com.ulyssesapp.mac.plist

It is usually straight-forward to find which .plist files in Library/Preferences you'll need to list, they always feature the application name.

Taking that a step further we can also declare a "personal files" application using a personal-files.cfg and then cherry pick any other files we want to backup while keeping them out of a public repo:

[application]
name = Personal Files

[configuration_files]
.gitconfig.local
.extra

When I declare this in my main .mackup.cfg they are handled with ease:

[storage]
engine = iCloud
directory = Mackup

# Apps to sync — if empty, syncs all supported.
# custom: personal-files, ulysses
[applications_to_sync]
personal-files
spotify
...
ulysses

A simple $ mackup backup saves everything to iCloud and I can later $ mackup restore on a fresh install to get these settings back (you can also easily $ mackup uninstall).

Colorschemes

My all-time favorite colorscheme for code-editing is Catppuccin. That said, there are times when I like to dabble with something new, just to have some variety.

One Half Dark Screenshot

Example of a React app with the Catppuccin colorscheme

Here's how everything is organized:

1. Colorschemes

The settings for individual colorschemes are stored in . To add a new colorscheme, add a file for it here.

2. Terminal Colorschemes

Since I use vim in the terminal, I need corresponding iTerm2 or Kitty colorschemes for every vim colorscheme. My iTerm2 colorschemes are stored in itermcolors/, but of course must be added manually to the iTerm profile. Kitty colorschemes are defined in ~/.config/kitty/themes/ and can be set with kitty's built-in theme manager: $ kitty +kitten themes --reload-in=all.

Multiple pre-made colorschemes are available online for both iTerm2 and Alacritty:

3. Tmux Custom Overrides

The last tweak is for Tmux. I like to set a custom statusline depending on what colorscheme I'm using. The main tmux.conf file contains all the settings that Tmux needs. Uncomment the section for a specific statusline to enable it.

## Detailed Catppuccin Statusline ##

# Set status bar color to match background
set-option -g status-style bg=default

## Set status bar position to top
# set-option -g status-position top

## Change spacing between window and statusline
if -F '#{!=:#{status},2}' {
  set -Fg 'status-format[1]' '#{status-format[0]}'
  set -g 'status-format[0]' ''
  set -g status 2
}

[...]

I also use tmux plugin manager to manage my tmux plugins. Clone the repository and press prefix + I to install plugins:

$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

Useful Colorscheme Links

My Favorite Programming Fonts

I've recently branched out to explore some of the different mono-spaced fonts available, both free and premium. Here is a list of my favorites.

Free Fonts

Included in my Brewfile and installed by default via Homebrew Cask Fonts

Premium Fonts

You have to give people money if you want these. 🤑

Ligatures

I first discovered ligatures through Fira Code, which IMO is probably the king of programming fonts. After using Fira Code, it's hard to go back to a sans-ligature typeface. Therefore †all the fonts I've included in my fave's list do include ligatures, although some have more than others.

Operator Mono does not include ligatures but can be easily patched to add them.

Nerd Font Variants

I use Devicons in my editor, and these require patched fonts in order to display properly. For most free fonts, there are pre-patched Nerd Font variants that include the various glyphs and icons.

Homebrew Cask Fonts includes both original and Nerd Font variants. For example:

# Original font
$ brew cask install font-fira-code

# Patched variant
$ brew cask install font-firacode-nerd-font

If using a font that does not have a patched variant (e.g. MonoLisa) iTerm2 has an option to use an alternate font for non-ASCII characters.

iterm2-font-settings

Useful Font Links

Some cool dotfile repos

Helpful web resources on dotfiles, et al.

License

Copyright © 2023 Joshua Yin. MIT License

About

A backup of my dotfiles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published