Skip to content

Instantly share code, notes, and snippets.

@taymoork2
Last active August 26, 2024 18:05
Show Gist options
  • Save taymoork2/65e375a6ad7ca04cd92b306a158c28e3 to your computer and use it in GitHub Desktop.
Save taymoork2/65e375a6ad7ca04cd92b306a158c28e3 to your computer and use it in GitHub Desktop.
### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust
### End of Zinit's installer chunk
# Workaround for zinit issue#504: remove subversion dependency. Function clones all files in plugin
# directory (on github) that might be useful to zinit snippet directory. Should only be invoked
# via zinit atclone"_fix-omz-plugin"
_fix-omz-plugin() {
if [[ ! -f ._zinit/teleid ]] then return 0; fi
if [[ ! $(cat ._zinit/teleid) =~ "^OMZP::.*" ]] then return 0; fi
local OMZP_NAME=$(cat ._zinit/teleid | sed -n 's/OMZP:://p')
git clone --quiet --no-checkout --depth=1 --filter=tree:0 https://github.com/ohmyzsh/ohmyzsh
cd ohmyzsh
git sparse-checkout set --no-cone plugins/$OMZP_NAME
git checkout --quiet
cd ..
local OMZP_PATH="ohmyzsh/plugins/$OMZP_NAME"
local file
for file in ohmyzsh/plugins/$OMZP_NAME/*~(.gitignore|*.plugin.zsh)(D); do
local filename="${file:t}"
echo "Copying $file to $(pwd)/$filename..."
cp -r $file $filename
done
rm -rf ohmyzsh
}
# oh-my-zsh
function omzPlugin() {
zinit ice atpull"%atclone" atclone"_fix-omz-plugin" lucid $2
zinit snippet OMZP::$1
}
function omzLib() {
zinit wait'!' lucid for OMZL::$1
}
### Update ZINIT
zinit self-update
# zinit update --all --parallel --quiet
# OH-MY-ZSH libs
omzLib completion.zsh
omzLib correction.zsh
omzLib directories.zsh
omzLib git.zsh
omzLib grep.zsh
omzLib history.zsh
omzLib key-bindings.zsh
omzLib completion.zsh
# omzLib termsupport.zsh
## OH-MY-ZSH plugins
# MacOS
if [[ `uname` == "Darwin" ]]; then
omzPlugin macos
fi
# system
omzPlugin iterm2
omzPlugin ssh-agent
omzPlugin sudo
omzPlugin cp
omzPlugin rsync wait"1"
omzPlugin gpg-agent
# git
omzPlugin git
omzPlugin git-flow wait"1"
omzPlugin github wait"1"
# node
omzPlugin node wait"1"
omzPlugin yarn wait"1"
# omzPlugin nvm wait"1"
# python
omzPlugin python wait"1"
# java
omzPlugin jenv wait"1"
# ruby
omzPlugin rvm wait"1"
# docker
omzPlugin docker wait"1"
# httpie
# omzPlugin httpie wait"1"
# zsh
omzPlugin z
omzPlugin fasd
omzPlugin fzf
omzPlugin asdf wait"1"
omzPlugin command-not-found wait"1"
omzPlugin common-aliases
omzPlugin compleat wait"1"
omzPlugin colorize wait"1"
# omzPlugin per-directory-history wait"1"
##
### PLUGINS
# git-extras
zinit ice as"program" pick"$ZPFX/bin/git-*" make"PREFIX=$ZPFX"
zinit light tj/git-extras
# direnv
zinit ice as"program" make'!' atclone'./direnv hook zsh > zhook.zsh' \
atpull'%atclone' pick"direnv" src"zhook.zsh"
zinit light direnv/direnv
# enhancd
zinit ice as"program" pick"init.zsh" wait"2" lucid
zinit light b4b4r07/enhancd
# diff-so-fancy
zinit ice as"program" pick"bin/git-dsf" wait"2" lucid
zinit light zdharma-continuum/zsh-diff-so-fancy
# pyenv
zplugin lucid as'command' pick'bin/pyenv' atinit'export PYENV_ROOT="$PWD"' \
atclone'PYENV_ROOT="$PWD" ./libexec/pyenv init - > zpyenv.zsh' \
atpull"%atclone" src"zpyenv.zsh" nocompile'!' for \
pyenv/pyenv
# poetry
zinit ice pick'poetry.zsh' wait"2" lucid
zinit light darvid/zsh-poetry
# nvm
if ! [ -f .nvmrc ]; then export NVM_NO_USE=true; zinit ice wait"0" lucid; fi
export NVM_AUTO_USE=true
zinit light lukechilds/zsh-nvm
# better-npm
zinit ice wait"1" lucid
zinit light lukechilds/zsh-better-npm-completion
# tab-title
zinit ice wait"1" lucid
zinit light trystan2k/zsh-tab-title
ZSH_TAB_TITLE_ONLY_FOLDER=true
ZSH_TAB_TITLE_ADDITIONAL_TERMS='alacritty'
# fzf-fasd
zinit ice wait"1" lucid
zinit light wookayin/fzf-fasd
# navi
zinit ice wait"1" lucid
zinit light denisidoro/navi
# thefuck
zinit ice wait"1" lucid
zinit light laggardkernel/zsh-thefuck
# Docker completions
zinit wait lucid as"completion" for \
OMZP::docker/completions/_docker \
OMZP::docker-compose/_docker-compose
# Autosuggestions & fast-syntax-highlighting
# zinit ice wait lucid atinit"zpcompinit; zpcdreplay"
# zinit light z-shell/F-Sy-H
# unset 'FAST_HIGHLIGHT[chroma-whatis]' 'FAST_HIGHLIGHT[chroma-man]'
zinit wait lucid light-mode for \
atinit"zicompinit; zicdreplay" \
z-shell/F-Sy-H \
atload"_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions
# zsh-autosuggestions
# zinit ice wait lucid atload"_zsh_autosuggest_start"
# zinit light zsh-users/zsh-autosuggestions
# This is a clean-room implementation of the Fish shell's history search feature
zinit light zsh-users/zsh-history-substring-search
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# zdharma-continuum/history-search-multi-word. ctrl + r
zinit ice wait"1" lucid
zinit load zdharma-continuum/history-search-multi-word
###
autoload -Uz compinit
compinit
zicompinit
zinit cdreplay -q # <- execute compdefs provided by rest of plugins
zinit cdlist # look at gathered compdefs
### OH-MY-ZSH carry-over
autoload -Uz is-at-least
# ls colors
autoload -U colors && colors
### ENVIRONMENT VARIABLES
export BAT_CONFIG_PATH=~/bat.conf
export LSCOLORS="Gxfxcxdxbxegedabagacad"
### Homebrew requires this
export PATH="/usr/local/sbin:$PATH"
# Set Default EDITOR to neovim
EDITOR='nvim'
### ALIASES
alias cat="bat --paging=never"
alias vim=nvim
### UNALIAS
# unalias rails `sc` for saucelabs
# unalias sc
### ZSH Settings
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
setopt hist_ignore_all_dups # remove older duplicate entries from history
setopt hist_reduce_blanks # remove superfluous blanks from history items
setopt inc_append_history # save history entries as soon as they are entered
setopt share_history # share history between different instances of the shell
setopt auto_list # automatically list choices on ambiguous completion
setopt auto_menu # automatically use menu completion
setopt auto_cd
setopt multios
setopt prompt_subst
unsetopt correct_all
setopt interactive_comments # allow comments in interactive shells
ZSH_AUTOSUGGEST_USE_ASYNC=true
MATCH_PREV_CM=true
COMPLETION_WAITING_DOTS="true"
# ENABLE_CORRECTION="true"
if [[ `uname` == "Darwin" ]]; then
# 1Password
OP_BIOMETRIC_UNLOCK_ENABLED=true
fi
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
# n
# export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"
# rust
. "$HOME/.cargo/env"
# pnpm
if [[ `uname` == "Darwin" ]]; then
export PNPM_HOME="$HOME/Library/pnpm"
fi
if [[ `uname` == "Linux" ]]; then
export PNPM_HOME="$HOME/.local/share/pnpm"
fi
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
# tabtab source for packages
[[ -f ~/.config/tabtab/zsh/__tabtab.zsh ]] && . ~/.config/tabtab/zsh/__tabtab.zsh || true
# gcloud
source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc"
source "$(brew --prefix)/share/google-cloud-sdk/completion.zsh.inc"
# fnm
# eval "$(fnm env --use-on-cd --shell zsh --version-file-strategy=recursive --corepack-enabled --resolve-engines)"
### CLEAR
clear
### Set Starship as the theme - LAST ITEM!!!
eval "$(starship init zsh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment