dotfiles/.zshrc

86 lines
2.5 KiB
Bash
Raw Normal View History

2024-10-21 08:50:44 -05:00
system_type=$(uname -s)
2024-10-17 17:28:50 -05:00
# shell options
setopt auto_cd
2024-10-21 08:50:44 -05:00
setopt append_history share_history histignorealldups
2024-10-17 17:28:50 -05:00
# aliases
alias ls="ls -F"
2024-10-21 08:50:44 -05:00
alias top10="print -l -- ${(o)history%% *} | uniq -c | sort -nr | head -n 10"
# Homebrew aliases
alias bv="brew-visit" # points to the function below because I'm complicated
2024-10-17 17:28:50 -05:00
alias bi="brew info"
alias bs="brew search"
2024-10-21 08:50:44 -05:00
# These depend on some installed packages, so just to be safe
2024-10-17 17:28:50 -05:00
[[ "$(command -v bat)" ]] && alias cat="bat"
[[ "$(command -v htop)" ]] && alias top="htop"
# environment variables
export CLICOLOR=1
# export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters
2024-10-21 08:50:44 -05:00
# Functions
2024-10-17 17:28:50 -05:00
fd() {
2024-10-21 08:50:44 -05:00
# DESC: I forget
# ARGS: $1 (optional):
# REQS: ???
# USAGE: fd [path]
2024-10-17 17:28:50 -05:00
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}
f() {
# DESC: Opens the Finder to specified directory. (Default is current oath)
# ARGS: $1 (optional): Path to open in finder
# REQS: MacOS
# USAGE: f [path]
open -a "Finder" "${1:-.}"
}
ql() {
# DESC: Opens files in MacOS Quicklook
# ARGS: $1 (optional): File to open in Quicklook
2024-10-21 08:50:44 -05:00
# REQS: MacOS
2024-10-17 17:28:50 -05:00
# USAGE: ql [file1] [file2]
qlmanage -p "${*}" &>/dev/null
}
brew-visit() {
2024-10-21 08:50:44 -05:00
# DESC: Open a Homebrew formula's web page
# ARGS: $1: Homebrew formula name
# REQS: MacOS
# USAGE: brew-visit [url]
2024-10-17 17:28:50 -05:00
open -a Safari `brew info "${1}" | grep ^http | head -1`
}
2024-10-21 08:50:44 -05:00
# See https://github.com/dduan/tre/blob/main/README.md
tre() { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; }
2024-10-17 17:28:50 -05:00
autoload -Uz compinit
compinit
2024-10-18 01:46:03 -05:00
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
2024-10-17 17:28:50 -05:00
source <(fzf --zsh)
[ -f ~/.config/op/plugins.sh ] && source ~/.config/op/plugins.sh
[ -f /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
[ -f /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh ] && source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
2024-10-21 08:50:44 -05:00
[ -f /opt/homebrew/opt/git-extras/share/git-extras/git-extras-completion.zsh ] && source /opt/homebrew/opt/git-extras/share/git-extras/git-extras-completion.zsh
[ -f /opt/homebrew/share/liquidprompt ] && source /opt/homebrew/share/liquidprompt
2024-10-17 17:28:50 -05:00
[ -e "${HOME}/.iterm2_shell_integration.zsh" ] && source "${HOME}/.iterm2_shell_integration.zsh"
2024-10-21 08:50:44 -05:00
if it2check
then
iterm2_print_user_vars() {
it2git
}
fi
eval "$(zoxide init --cmd j zsh)"
eval $(thefuck --alias)
# eval "$(starship init zsh)"