2024-07-16 04:39:57 -04:00
|
|
|
case "$-" in
|
|
|
|
*i*) ;;
|
|
|
|
*) return ;;
|
|
|
|
esac
|
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
# Completion options
|
|
|
|
autoload -Uz compinit && compinit -d "$XDG_CACHE_HOME/zsh/zcompdump"
|
|
|
|
zstyle ':completion:*' completer _expand_alias _complete _ignored
|
2024-07-16 04:39:57 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
## History options ##
|
|
|
|
HISTSIZE=100000
|
|
|
|
HISTFILESIZE="$HISTSIZE"
|
2024-07-16 05:15:58 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
setopt autocd
|
|
|
|
setopt promptsubst
|
2024-07-16 04:39:57 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
# Default options
|
2024-07-16 04:39:57 -04:00
|
|
|
alias cp='cp -iv'
|
|
|
|
alias mv='mv -iv'
|
|
|
|
alias rm='rm -vI'
|
|
|
|
alias mkdir='mkdir -pv'
|
2024-07-29 04:08:38 -04:00
|
|
|
alias ls='ls --color=auto -AF'
|
2024-07-16 04:39:57 -04:00
|
|
|
alias grep='grep --color=auto'
|
2024-07-29 04:08:38 -04:00
|
|
|
alias wget='wget --no-hsts-file'
|
|
|
|
cd() {
|
|
|
|
builtin cd "$@" && ls
|
|
|
|
}
|
2024-07-16 04:39:57 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
# Public and private IP addresses
|
2024-07-16 04:39:57 -04:00
|
|
|
alias ipp='curl https://ipinfo.io/ip && echo'
|
|
|
|
alias ipl='monitors local_ip'
|
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
# Shorthands
|
|
|
|
alias l='ls'
|
|
|
|
alias c='cd'
|
|
|
|
alias v='nvim'
|
|
|
|
alias vim='nvim'
|
|
|
|
alias g='git'
|
|
|
|
alias ff='fastfetch'
|
|
|
|
alias fetch='fastfetch'
|
|
|
|
|
|
|
|
# Other options or commands
|
|
|
|
alias ll='ls -l'
|
|
|
|
alias ga='git add'
|
|
|
|
alias gc='git commit'
|
|
|
|
alias gs='git status'
|
|
|
|
alias gp='git push'
|
|
|
|
alias gl='git pull'
|
|
|
|
|
|
|
|
parse_git_branch() {
|
|
|
|
command -v git >/dev/null 2>&1 || return
|
|
|
|
|
|
|
|
git_branch=$(git branch --no-color 2>/dev/null)
|
|
|
|
[ -z "$git_branch" ] && return
|
|
|
|
is_dirty=$(git status --porcelain 2>/dev/null)
|
|
|
|
[ -n "$is_dirty" ] && color="red" || color="magenta"
|
2024-07-16 04:39:57 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
printf '%s' " %F{${color}}${git_branch#* }"
|
|
|
|
}
|
2024-07-16 04:39:57 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
## Prompts ##
|
|
|
|
PROMPT="
|
|
|
|
%F{green}%n@%M %F{blue}%~\$(parse_git_branch) %F{reset}%% "
|
|
|
|
RPROMPT='%F{white}%*%F{reset}'
|
2024-07-16 04:39:57 -04:00
|
|
|
|
2024-07-29 04:08:38 -04:00
|
|
|
## External loading ##
|
|
|
|
if [ -d "$XDG_DATA_HOME/zsh/plugins" ]; then
|
|
|
|
for p in "$XDG_DATA_HOME"/zsh/plugins/*/*.plugin.zsh; do
|
|
|
|
. "$p"
|
2024-07-16 04:39:57 -04:00
|
|
|
done
|
2024-07-29 04:08:38 -04:00
|
|
|
unset p
|
2024-07-16 04:39:57 -04:00
|
|
|
fi
|