You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.5 KiB
Bash
69 lines
1.5 KiB
Bash
#
|
|
# .zshrc - started by panki on 20200226
|
|
#
|
|
|
|
autoload -Uz compinit promptinit
|
|
compinit
|
|
promptinit
|
|
|
|
# This will set the default prompt to the fade theme
|
|
prompt fade green
|
|
|
|
# Return Code on right prompt
|
|
RPS1='[%F{yellow}%?%f]'
|
|
|
|
# thanks to slashbeast for these ones
|
|
# Fancy cd that can cd into parent directory, if trying to cd into file.
|
|
# useful with ^F fuzzy searcher.
|
|
cd() {
|
|
if (( $+2 )); then
|
|
builtin cd "$@"
|
|
return 0
|
|
fi
|
|
|
|
if [ -f "$1" ]; then
|
|
echo "${yellow}cd ${1:h}${NC}" >&2
|
|
builtin cd "${1:h}"
|
|
else
|
|
builtin cd "${@}"
|
|
fi
|
|
}
|
|
|
|
setup_git_prompt() {
|
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
unset git_prompt
|
|
return 0
|
|
fi
|
|
|
|
local git_status_dirty git_branch
|
|
|
|
if [ "$(git status --untracked-files='no' --porcelain)" ]; then
|
|
git_status_dirty='%F{green}*'
|
|
else
|
|
unset git_status_dirty
|
|
fi
|
|
|
|
git_branch="$(git symbolic-ref HEAD 2>/dev/null)"
|
|
git_branch="${git_branch#refs/heads/}"
|
|
|
|
if [ "${#git_branch}" -ge 24 ]; then
|
|
git_branch="${git_branch:0:21}..."
|
|
fi
|
|
|
|
git_branch="${git_branch:-no branch}"
|
|
|
|
git_prompt=" %F{blue}[%F{253}${git_branch}${git_status_dirty}%F{blue}]"
|
|
|
|
}
|
|
|
|
precmd() {
|
|
setup_git_prompt
|
|
}
|
|
|
|
PS1='%F{green}%B%K{green}█▓▒░%F{white}%K{green}%B%n@%m%b%F{green}%K{black}█▓▒░%F{white}%K{black}%B %D{%a %b %d} %D{%I:%M:%S%P}
|
|
%}%F{green}%K{black}%B%~/%b%k${git_prompt}%f '
|
|
# aliases
|
|
alias grep='grep --colour=auto'
|
|
alias ll='ls -alFh'
|
|
lt () { ls -lt ${1} | head }
|