added .zshrc
parent
e0945703be
commit
71c4164036
@ -0,0 +1,68 @@
|
||||
#
|
||||
# .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 }
|
Loading…
Reference in New Issue