Add screenshot menu and update prompt

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-03-12 21:26:24 +01:00
parent d25e3618c4
commit 1792013f37
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
8 changed files with 214 additions and 9 deletions

View file

@ -58,7 +58,7 @@ export VISUAL=vim
export EDITOR="${VISUAL}"
export TERMINAL=termite
export BROWSER="google-chrome-beta"
export PAGER="most"
export PAGER="less"
export MANPAGER="${PAGER}"
# QT
@ -87,13 +87,52 @@ function current_branch() {
else
echo "[${branch}]"
fi
}
function file_count() {
count="$(ls -a -1 | wc -l)"
echo "[${count} files]"
}
function folder_size() {
size="$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')"
echo "[${size}B]"
}
function prompt_width() {
hostname="$(hostname)"
branch="$(current_branch)"
pwd="$(print -P %~)"
file_count="$(file_count)"
folder_size="$(folder_size)"
echo "$((${COLUMNS} - 19 - ${#hostname} - ${#branch} - ${#pwd} - ${#file_count} - ${#folder_size}))"
}
function precmd() {
# Print a newline before the prompt, unless it's the
# first prompt in the process.
if [ -z "$NEW_LINE_BEFORE_PROMPT" ]; then
NEW_LINE_BEFORE_PROMPT=1
elif [ "$NEW_LINE_BEFORE_PROMPT" -eq 1 ]; then
echo ""
fi
}
# Custom prompt
NEWLINE=$'\n'
export PS1="┌─"
export PS1="${PS1}%F{red}[%*]%f"
export PS1="${PS1}%F{blue}[%m]%f"
export PS1="${PS1}%F{yellow}[%~]%f"
export PS1="${PS1}%F{blue}"'$(current_branch)'"%f"
export PS1="${PS1}${NEWLINE}└─╼ "
export PS1="${PS1}"'${(r:$(prompt_width)::─:)}'
export PS1="${PS1}%F{yellow}"'$(file_count)'"%f"
export PS1="${PS1}%F{blue}"'$(folder_size)'"%f"
export PS1="${PS1}%F{red}"'$(current_branch)'"%f"
export PS1="${PS1}─┐"
export PS1="${PS1}${NEWLINE}└─╼ "
export RPROMPT="╾─┘"
#PS1="\n\[\e[30;1m\]\[\016\]l\[\017\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n\[\016\]m\[\017\]-(\[\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]"