Skip to content

Instantly share code, notes, and snippets.

@mkbabb
Last active January 28, 2025 15:25
Show Gist options
  • Select an option

  • Save mkbabb/0b9a0052ec7fdaac6b07f684eb6ae27d to your computer and use it in GitHub Desktop.

Select an option

Save mkbabb/0b9a0052ec7fdaac6b07f684eb6ae27d to your computer and use it in GitHub Desktop.
Cross platform ZSH config
export ZSH_FRAGMENTS_DIR="$HOME/.zshrc.d"
export ZSH="$HOME/.oh-my-zsh"
mkdir -p $ZSH_FRAGMENTS_DIR
GIST_URL="https://gist.github.com/mkbabb/0b9a0052ec7fdaac6b07f684eb6ae27d/raw/7a7c2a19c23d0ac8a7c8631f91cf09c312d606f3"
CROSS_PLATFORM_FILENAME="02-cross-platform.zsh"
CROSS_PLATFORM_GIST="$GIST_URL/$CROSS_PLATFORM_FILENAME"
# Download the cross-platform file only if it doesn't exist
if [ ! -f $ZSH_FRAGMENTS_DIR/$CROSS_PLATFORM_FILENAME ]; then
curl -L $CROSS_PLATFORM_GIST -o $ZSH_FRAGMENTS_DIR/$CROSS_PLATFORM_FILENAME
fi
for config_file in $ZSH_FRAGMENTS_DIR/*.zsh; do
source "$config_file"
done
# Cross-platform, cross-shell options
# History settings
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
# Theme configuration
ZSH_THEME="ys"
# Oh-My-Zsh plugin configuration
plugins=(
git
)
# Common aliases
alias zshconfig="mate ~/.zshrc"
alias ohmyzsh="mate ~/.oh-my-zsh"
# Znap configuration
[[ -r ~/Repos/znap/znap.zsh ]] ||
git clone --depth 1 -- \
https://github.com/marlonrichert/zsh-snap.git ~/Repos/znap
source ~/Repos/znap/znap.zsh # Start Znap
source $ZSH/oh-my-zsh.sh
zstyle ':autocomplete:*' list-lines 7
zstyle ':autocomplete:history-search:*' list-lines 7
zstyle ':autocomplete:history-incremental-search-*:*' list-lines 7
zstyle ':autocomplete:*' min-input 1
zstyle ':autocomplete:*' fzf-completion yes
znap source zsh-users/zsh-syntax-highlighting
znap source marlonrichert/zsh-autocomplete
znap source zsh-users/zsh-autosuggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment