diff --git a/.gitignore b/.gitignore index 268753e..76c00e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,55 @@ -.vscode/extensions +*.sock +*.swp +.1password +.anyconnect +.awesomecache +.bash_history +.cache +.CFUserTextEncoding +.cisco +.colima +.config/gtk-2.0/ +.config/zsh/plugins +.docker/ +.DS_Store +.gitignore_global +.gk/repoMapping.json +.gnupg +.gnupg_* +.lesshst +.local/bin/ +.local/share +.node_repl_history +.npm +.nvm +.rest-client +.sonarlint +.ssh +.tldrc +.Trash +.vault-token +.viminfo +.vscode +.wget-hsts +.yarn +.yarnrc +.zcompcache +.zcompdump +.zsh_history +.zsh_sessions +awesomecache +Desktop +Development +Documents +Downloads +Library +Movies +Music +node_modules +OneDrive\ \-\ Target\ Corporation +package.json +Pictures +Public +src +tmp +yarn.lock diff --git a/.zshrc b/.zshrc index da5f403..c10b56b 100644 --- a/.zshrc +++ b/.zshrc @@ -1,71 +1,47 @@ system_type=$(uname -s) # shell options -setopt auto_cd -setopt append_history share_history histignorealldups +setopt auto_cd append_history share_history histignorealldups # aliases -alias ls="ls -F" -alias top10="print -l -- ${(o)history%% *} | uniq -c | sort -nr | head -n 10" +get_ls_command() { + command -v lsd &>/dev/null + if [ $? -eq 0 ]; then + echo "lsd" + else + echo "ls" + fi +} +alias ls="$(get_ls_command) -F" + +# git aliases +alias g=git +alias gi=git # Homebrew aliases +alias b="brew" alias bv="brew-visit" # points to the function below because I'm complicated alias bi="brew info" alias bs="brew search" +# YADM aliases +alias y="yadm" +alias ys="yadm status" + # These depend on some installed packages, so just to be safe [[ "$(command -v bat)" ]] && alias cat="bat" [[ "$(command -v htop)" ]] && alias top="htop" # environment variables +export PATH="$PATH:${HOME}/.local/bin" export CLICOLOR=1 # export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters -# Functions +# Load functions +fpath=("$HOME/.functions" "${fpath[@]}") +autoload -Uz ql f brew-visit tre compinit && compinit -fd() { - # DESC: I forget - # ARGS: $1 (optional): - # REQS: ??? - # USAGE: fd [path] - 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 - # REQS: MacOS - # USAGE: ql [file1] [file2] - qlmanage -p "${*}" &>/dev/null -} - -brew-visit() { - # DESC: Open a Homebrew formula's web page - # ARGS: $1: Homebrew formula name - # REQS: MacOS - # USAGE: brew-visit [url] - open -a Safari `brew info "${1}" | grep ^http | head -1` -} - -# See https://github.com/dduan/tre/blob/main/README.md -tre() { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; } - -autoload -Uz compinit -compinit - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh -source <(fzf --zsh) +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh && 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 @@ -73,8 +49,7 @@ source <(fzf --zsh) [ -f /opt/homebrew/share/liquidprompt ] && source /opt/homebrew/share/liquidprompt [ -e "${HOME}/.iterm2_shell_integration.zsh" ] && source "${HOME}/.iterm2_shell_integration.zsh" -if it2check -then +if it2check; then iterm2_print_user_vars() { it2git }