:round_pushpin: My dotfiles for macOS using Fish/Zsh, Neovim, and Tmux
These are the dotfiles I use on my Mac computers, currently running macOS Catalina (10.15). They are geared primarily towards web development with Rails, React, and Vue. I use a terminal-based development environment built on Fish, Tmux, and Neovim. Also included are my iTerm2 and Alacritty profiles.
Need to provision a new Mac from scratch? My Mac Bootstrap script installs and configures the software, dotfiles, and general preferences I use for web development.
▹ Provision a new Mac with Mac Bootstrap.
NOTE: Mac Bootstrap automatically clones and installs this dotfiles repo.
The dotfiles assume you are running macOS with the following software pre-installed:
All of the above and more are included in Mac Bootstrap
The install script will create the needed directories and symlinks for your setup, adding config files for both Zsh and Fish.
Setup your shell. (See Fish/Zsh instructions below.)
Run the installation script.
$ git clone https://github.com/joshukraine/dotfiles.git ~/dotfiles $ bash ~/dotfiles/install.sh
I have used Zsh for years and really liked it. Recently I've switched to Fish, and am loving that too! I've kept both of my configs intact in my dotfiles. Running the install script will link configs for both Fish and Zsh shells.
$ brew install zsh
$ chsh -s $(which zsh)
$ brew install fish
$ echo /usr/local/bin/fish | sudo tee -a /etc/shells
$ chsh -s /usr/local/bin/fish
~/.localdirectories if they don’t already exist.
install.shthere are still a couple of things that need to be done.
brew bundle install
:checkhealthand resolve errors/warnings.
Thanks to a great blog post by Trevor Brown, I learned that you can quickly set up iTerm2 by exporting your profile. Here are the steps.
Getting set up after a fresh install is simple.
I regularly use two Mac computers: a desktop and laptop. Most of my configs are identical between the two, but there are some some differences. I also occasionally install my dotfiles on other machines (family computer, wife's computer, your computer if I can get to it... 😈)
For this reason, I've introduced a
machines/folder where I keep configs that are specific to a given computer. Machine-specific configs should be stored in sub-folders of
machines/and named for the
hostnameof that machine. The overall structure looks like this:
machines/ ├── joshuas-imac │ ├── Brewfile -> ../../Brewfile │ ├── Brewfile.lock.json │ ├── alacritty.yml │ ├── colors.fish │ ├── colorscheme.vim │ ├── com.googlecode.iterm2.plist │ ├── starship.toml │ └── tmux.conf.custom └── joshuas-mbp15 ├── Brewfile -> ../../Brewfile ├── Brewfile.lock.json ├── alacritty.yml ├── colors.fish ├── colorscheme.vim ├── com.googlecode.iterm2.plist ├── starship.toml └── tmux.conf.custom
My current Homebrew Bundle approach depends heavily on the above setup. I have a Fish function (
bb) which runs a machine-specific
Brewfilebased on the
hostnameof the current computer. (See
My all-time favorite colorscheme for code-editing is Solarized Dark. That said, there are times when I like to dabble with something new, just to have some variety. In the past it's been painful to switch colorschemes for vim since I also needed to find a suitable profile for iTerm2, make tweaks to tmux.conf, etc. Sometimes the colorschemes were 24-bit only (think
set termguicolors) and others were more simple (256-color), like the original version of Solarized.
I've now introduced an approach for switching between colorschemes which I hope will be more straightforward. It's still not a one-step operation, but all the colorschemes and their individual settings can be stored simultaneously, and switching between them takes minimal effort.
Example of a React app with the One Half Dark colorscheme
At the time of this writing, I've incorporated 11 colorschemes, all of which require true color support.
Here's how everything is organized:
The settings for individual colorschemes are stored in separate files. To add a new colorscheme, add a file for it here.
nvim/ └── colorschemes ├── gruvbox.vim ├── material.vim ├── night-owl.vim ├── nightfly.vim ├── nord.vim ├── oceanic-next.vim ├── onehalfdark.vim ├── solarized.vim ├── tender.vim ├── vim-monokai-tasty.vim └── vim-one.vim
Every machine I manage has a
colorscheme.vimfile in its directory. That file defines in one line which colorscheme should be used. For example:
exe 'source' stdpath('config') . '/colorschemes/gruvbox.vim'
This theme is then loaded in
nvim/init.vimwith the following line (see the Appearance section):
exe 'source' "$DOTFILES/machines/$HOST_NAME/colorscheme.vim"
Since I use vim in the terminal, I need corresponding iTerm2 or Alacritty colorschemes for every vim colorscheme. My iTerm2 colorschemes are stored in
itermcolors/, but of course must be added manually to the iTerm profile. Alacritty colorschemes are defined in
Multiple pre-made colorschemes are available online for both iTerm2 and Alacritty:
The last tweak is for Tmux. I like to set custom hex color codes for the status bar depending on which colorscheme I'm using. Each machine profile now has its own
tmux.conf.customfile. In particular, it can be nice to adjust the background of the status bar to better match the current colorscheme.
tmux.conffile contains all the settings that Tmux needs. However, any setting that is re-declared in
machines/$HOST_NAME/tmux.conf.customwill override the defaults.
setw -g window-status-style fg=$BLACK,bg=$BRIGHT_BLUE setw -g window-status-current-style fg="#fbf1c7",bg=$BRIGHT_RED set -g pane-border-style bg=default,fg="#665c54" set -g status-left "#[fg=$BRIGHT_GREEN][#S] #[fg=$RED]w#I #[fg=$BLUE]p#P" set -g status-style bg="#3c3836"
set -g status-style bg="#2c3b41"
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.
Included in my
Brewfileand installed by default via Homebrew Cask Fonts
You have to give people money if you want these. 🤑
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.
Homebrew Cask Fonts includes both original and Nerd Font variants. For example:
# Original font $ brew cask install font-fira-code
$ 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.
I recently discovered a resolution to some significant performance issues I had been experiencing running Vim on macOS. These issues were particularly painful when editing Ruby files. I've documented what I learned here:
UPDATE: After "trying" Neovim for nearly two years, I'm ready to make the switch permanent. Instead of linking to my
.vimrcas described below, I've now moved all my configs over to
I'm currently trying out Neovim, and so far things are working nicely. For now I have things set up so I can run either Vim or Neovim interchangeably. This is accomplished by telling Neovim's config file (
~/.config/nvim/init.vim) to source the standard Vim config file (
.zshrcscript can be profiled by touching the file
~/.zshrc.profilerand starting a new login shell. To see the top 20 lines that are taking the most time use the
zshrc_profilerparameters are number of lines to show (20) and path to profiler log file (
Copyright © 2014–2020 Joshua Steele. MIT License