- Don't change how the shell works too much! I
sshinto other machines installed withbash, and it's essential that I don't need to context switch too hard when I do. This config tries to accomplish this by:- using
zsh(fairlybashcompatible) - focusing on making common shell operations easier and faster, not replacing them wholesale. Think "turn the shell prompt into an IDE" - code should be faster to write, but it should look the same as if you didn't have the IDE
- using
- Make my customizations easy to install, easy to play with, and easy to uninstall. This should be easy to "try out". This config tries to accomplish this by:
- not replacing
~/.zshrcbut instead providingsource <file>lines to add to it - this lets users keep their own configuration and toggling mine on and off by commenting a line or two - putting different functionality in different files to source. Want only one of
zp_promptandzshrc_common?sourceone but not the other - adding
curlinstall commands (I actually useflingto provide these files so I can easily keep them in Git) - noting keyboard shortcuts the tools add I really like in this README and adding screenshots
- not replacing
It's possible to install my settings with curl using commands similar to the following:
curl -Lo ~/.zshrc_common.zsh https://raw.githubusercontent.com/bbkane/dotfiles/master/zsh/.zshrc_common.zshHowever, I install my dotfiles via cloning this repo and using fling to create symlinks to the appropriate places.
Like a river, Installation instructions for plugins tend to wend slowly over time, so I'm trying to add "last updated" sections to each header here.
Also note that these should be installed in order... in particular, completions need to be added to fpath BEFORE calling compinit and fzf-tab needs to be loaded AFTER compinit.
I'm trying to put all autoload -Uz <thing> at the top of ~/.zshrc to keep them together and reduce startup times. As of 2024-06-02, so far I have:
autoload -Uz add-zsh-hook # zp_prompt , envelope
autoload -Uz bashcompinit # completions
autoload -Uz compinit # completions
autoload -Uz edit-command-line # common settingshttps://unix.stackexchange.com/a/33898/185953 has a great explanation of what the -Uz flags
"What is the -Uz about?", you ask? Well, that's just a set of options that will cause
autoloadto do the right thing, no matter what options are being set otherwise. TheUdisables alias expansion while the function is being loaded and thezforces zsh-style autoloading even ifKSH_AUTOLOADis set for whatever reason.
Install zsh-completions
last updated: Fri 2024-10-11
NOTE: this can add startup time, so inspect this if that slows down (see ./README_notes.md).
This particularly helps with openssl completion.
brew install zsh-completions
Add the following to ~/.zshrc:
# zsh-completions
FPATH=$(brew --prefix)/share/zsh-completions:$FPATHIf getting an zsh compinit: insecure directories warning, see the output of brew info zsh-completions.
# Add Homebrew completions not from zsh-completions
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
# Add spot to put local completions
FPATH="$HOME/fbin:$FPATH"This needs to be done AFTER all modifications to $FPATH, but before some of the plugins below.
See https://stackoverflow.com/a/67161186/2958070 for more details
compinit
bashcompinitAt the end, this part of ~/.zshrc should look like this:
# zsh-completions
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
# Add Homebrew completions not from zsh-completions
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
# Add spot to put local completions
FPATH="$HOME/fbin:$FPATH"
compinit
bashcompinitInstall common settings
Install into ~/.zshrc_common.zsh, then use the following command to source it from ~/.zshrc.
Requires autoload -Uz add-zsh-hook (see above)
# See https://github.com/bbkane/dotfiles
source ~/.zshrc_common.zshOpen a new zsh shell.
Install zp_prompt
Requires autoload -Uz add-zsh-hook, see above.
Install into ~/.zshrc_prompt.zsh, then use the following command to source it from ~/.zshrc
brew install pastel # Optional but highly recommended# See https://github.com/bbkane/dotfiles
source ~/.zshrc_prompt.zsh
zp_prompt_pastel dodgerblue lightgreenOpen a new zsh shell.
Install fzf
Last updated: 2024-04-02
- Search through shell history interactively (
<Ctrl>r) - Search through file names (
<Ctrl>t). Example:cat <Ctrl>t - Search through file names (
**<Tab>). Examplecat ./project/**<Tab> - Adds autocomplete with
<Tab>tokill - SSH with completion from
/etc/hostsand~/.ssh/configwithssh **<Tab> unset,export, andunaliaswith completion withunset **<Tab>
brew install fzfAdd the following to ~/.zshrc:
eval "$(fzf --zsh)"Install fzf-tab
Last updated: 2024-04-02
Add fuzzy completion to tab-complete. Very useful when there's a bunch of similarly named things in a directory (like ticket notes).
Warning from the README:
- make sure fzf is installed
- fzf-tab needs to be loaded after
compinit, but before plugins which will wrap widgets, such as zsh-autosuggestions or zsh-syntax-highlighting
git clone https://github.com/Aloxaf/fzf-tab ~/Git-GH/fzf-tabAdd to zshrc:
# https://github.com/Aloxaf/fzf-tab
# NOTE: fzf-tab should be installed before most other things. See the README
source ~/Git-GH/fzf-tab/fzf-tab.plugin.zsh
# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
# NOTE: don't use escape sequences here, fzf-tab will ignore them
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# force zsh not to show completion menu, which allows fzf-tab to capture the unambiguous prefix
zstyle ':completion:*' menu no
# preview directory's content with eza when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# switch group using `<` and `>`
zstyle ':fzf-tab:*' switch-group '<' '>'Install eza for directory previews:
brew install ezaNOTE: the README suggests using build-ff-tab-module to speed up colorizing files, but the build failed for me and I'm not currently having a speed problem
Install zsh-autosuggestions
Last updated: 2024-04-02
Add auto-complete based on history. Accept suggestions with <Ctrl><Space> or right arrow key.
brew install zsh-autosuggestionsI used HTML Color Picker: #c0c0c0 to get the highlight color.
# NOTE: this source location might change if brew changes how it installs
# See `brew info zsh-autosuggestions`
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
bindkey '^ ' autosuggest-accept # also use Ctrl+Space to accept
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#737373'Open a new zsh shell.
Install zoxide
Last updated: 2024-04-02
zoxide is a replacement for fasd, which has been deprecated in Homebrew :(
It has some differences:
- doesn't support frecently used files with
v - requires a space after z to trigger fancy autocompletion:
z startofname<SPACE><TAB> - It does let you edit the database.
I think my favorite use is zi to open a fzf picker for frecently used files.
brew install zoxideAlso see notes about compinit in the README.
eval "$(zoxide init zsh)"Install zsh-syntax-highlighting
Last updated: 2025-08-26
Add syntax highlighting while typing:
brew install zsh-syntax-highlightingAdd to ~/.zshrc (the docs say this should be done at the bottom of ~/zshrc:
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zshInstall warhol.plugin.zsh
Last updated: 2024-04-02
Colorize command output using grc and lscolors
brew install grcgit clone https://github.com/unixorn/warhol.plugin.zsh.git ~/Git-GH/warhol.plugin.zsh# https://github.com/unixorn/warhol.plugin.zsh
source ~/Git-GH/warhol.plugin.zsh/warhol.plugin.zsh




