use tabs as indentation, shorten flags, remove steam lib paths (kys steam thx), add optimized segments and 'interval' which runs a command every X seconds, set global variables, disable hot reload, use $ZDOTDIR, switch back to zsh-synthax-highlighting

This commit is contained in:
Alex 2020-04-06 00:18:15 +02:00
parent 617f2578fa
commit 851f370783
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
9 changed files with 122 additions and 80 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
.zcompdump
.zcomp*

6
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "fast-syntax-highlighting"]
path = fast-syntax-highlighting
url = https://github.com/zdharma/fast-syntax-highlighting
[submodule "powerlevel10k"]
path = powerlevel10k
url = https://github.com/romkatv/powerlevel10k.git
[submodule "zsh-autosuggestions"]
path = zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions
[submodule "zsh-synthax-highlighting"]
path = zsh-synthax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting

8
.zshrc
View File

@ -1,11 +1,7 @@
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
startx
logout
fi
[[ ! -f ${ZDOTDIR}/.p10k.zsh ]] || source ${ZDOTDIR}/.p10k.zsh
source "${ZDOTDIR}/completions.zsh"
source "${ZDOTDIR}/preferences.zsh"
source "${ZDOTDIR}/bindings.zsh"

View File

@ -15,5 +15,4 @@ zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle :compinstall filename '${ZDOTDIR}/completions.zsh'
autoload -Uz compinit
compinit
autoload -Uz +X compinit && compinit

View File

@ -1,52 +1,90 @@
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32:$HOME/.steam/bin/:$LD_LIBRARY_PATH
export EDITOR=vim
export DOCKER_HOST=ssh://nbg-0
# GPG SSH
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
function build-n-push {
docker build ${1} --tag=localhost:5000/${2} --force-rm=true --compress=true && docker push localhost:5000/${2}
docker build ${1} --tag=localhost:5000/${2} --force-rm --compress && docker push localhost:5000/${2} # --squash can eat disk space quickly due to diffs not being taken in calculation
}
function gitsubrepo {
find * -maxdepth 1 -mindepth 1 -type d -name ".git" -exec sh -c '(DIR={}; DIR=${DIR%%.git} && cd $DIR && echo $DIR && git status -s)' \;
}
function osutab {
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
}
function tonullpointer {
if [ -z ${1} ]; then
RANDFN=${RANDOM}
> /tmp/${RANDFN}
curl -F"file=@/tmp/${RANDFN}" http://0x0.st
rm /tmp/${RANDFN}
else
curl -F"file=@${1}" http://0x0.st
fi
if [ -z ${1} ]; then
RANDFN=${RANDOM}
> /tmp/${RANDFN}
curl -F"file=@/tmp/${RANDFN}" http://0x0.st
rm /tmp/${RANDFN}
else
curl -F"file=@${1}" http://0x0.st
fi
}
function ffmpeg-gif {
ffmpeg -hwaccel vdpau -ss $2 -to $3 -i $1 -r 60 -pix_fmt bgr8 -vf "mpdecimate,normalize,scale=480:-1:flags=spline,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -loop 0 $4
ffmpeg -hwaccel vdpau -ss $2 -to $3 -i $1 -r 60 -pix_fmt bgr8 -vf "mpdecimate,normalize,scale=480:-1:flags=spline,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -loop 0 $4
}
function ffmpeg-vid {
ffmpeg -hwaccel vdpau -ss $2 -to $3 -i $1 -r 60 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $4
ffmpeg -hwaccel vdpau -ss $2 -to $3 -i $1 -r 60 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $4
}
function ffmpeg-compress {
ffmpeg -hwaccel vdpau -i $1 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $2
}
function getnhentai {
for i in {1..$1}; do
curl -sSLO --fail https://i.nhentai.net/galleries/${2}/${i}.png || \
curl -sSLO --fail https://i.nhentai.net/galleries/${2}/${i}.jpg;
done
for i in {1..9}.*; do
mv $i 0$i;
done
}
alias recordscreen='ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0 -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -crf 0 -vf "deflate,mpdecimate"'
alias ytdldown='youtube-dl --no-part --newline -xcw --audio-format best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(album)s/%(track)s.%(ext)s"'
alias ytdldown='youtube-dl --no-part --newline -ixcw --audio-format best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(album)s/%(track)s.%(ext)s"'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias diff='diff --color=auto'
function man {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}
function interval {
typeset -g CTIME=$(date +%s)
[[ $(( $CTIME - ${LASTCTIME:=0} )) -gt 60 ]] && typeset -g LASTCTIME=$CTIME || return
}
function prompt_docker_host() {
p10k segment -b blue -i '' -t "${DOCKER_HOST#*://}" -c "${DOCKER_HOST}"
}
typeset -g POWERLEVEL9K_DOCKER_HOST_SHOW_ON_COMMAND='docker'
function prompt_dbus_mpris() {
typeset -g LASTRESP=${RESP:=0}
typeset -g RESP="$(qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata 2>/dev/null)"
if [[ $RESP != $LASTRESP ]]; then
RFMT="$(print ${RESP} | grep -oP '(?<=^xesam:title: ).+')"
ARTIST="$(print ${RESP} | grep -oP '(?<=^xesam:artist: ).+')"
[ ! -z ${ARTIST} ] && RFMT="${ARTIST} - ${RFMT}"
fi
p10k segment -b purple -i '' -t "${RFMT}" -c "${RFMT}"
}
function prompt_new_mail() {
interval && local MAILS=$(find ~/Mail/*/Inbox/new -type f | wc -l)
p10k segment -b yellow -i '' -t "${MAILS}" -c "${MAILS/#%0}"
}
function prompt_pacman_upgrade() {
interval && local PACKAGES=$(pacman -Qu | wc -l)
p10k segment -b cyan -i '' -t "${PACKAGES}" -c "${PACKAGES/#%0}"
}
typeset -g POWERLEVEL9K_PACMAN_UPGRADE_SHOW_ON_COMMAND='pacman'

@ -1 +0,0 @@
Subproject commit 634ab246365ef6b465b4cdf7c6f0727ec04759a9

@ -1 +1 @@
Subproject commit 826d8adf44caa562dc36d8b12b461e89eb035e78
Subproject commit 552042c4b437485c222f563ec4a02ddd57e433ab

View File

@ -1,51 +1,60 @@
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
typeset -g HISTFILE=~/.histfile
typeset -g HISTSIZE=1000
typeset -g SAVEHIST=1000
typeset -g ZLE_RPROMPT_INDENT=0
setopt appendhistory autocd extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space nobeep
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
#typeset -g POWERLEVEL9K_MODE='nerdfont-fontconfig'
if [ -z "$SSH_CONNECTION" ] && ! [ -z "$DISPLAY" ]; then
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
os_icon
time
ram
load
battery
ssh
root_indicator
newline
vi_mode
status
dir
dir_writable
)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
command_execution_time # duration of the last command
background_jobs # presence of background jobs
vcs
direnv # direnv status (https://direnv.net/)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
pyenv # python environment (https://github.com/pyenv/pyenv)
nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
nvm # node.js version from nvm (https://github.com/nvm-sh/nvm)
nodeenv # node.js environment (https://github.com/ekalinin/nodeenv)
rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv)
rvm # ruby version from rvm (https://rvm.io)
aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
public_ip # public IP address
)
POWERLEVEL9K_MODE=nerdfont-complete
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
os_icon
time
ram
load
battery
disk_usage
ssh
root_indicator
newline
vi_mode
status
dir
dir_writable
)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
command_execution_time
background_jobs
vim_shell
pacman_upgrade
new_mail
docker_host
dbus_mpris
vcs
virtualenv
pyenv
public_ip
)
else
export TERM="xterm";
autoload -Uz promptinit
promptinit
prompt clint
export TERM="xterm";
autoload -Uz promptinit
promptinit
prompt clint
fi
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
typeset -g POWERLEVEL9K_USE_CACHE=true
source ${ZDOTDIR}/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source ${ZDOTDIR}/zsh-synthax-highlighting/zsh-syntax-highlighting.plugin.zsh
typeset -g ZSH_HIGHLIGHT_HIGHLIGHTERS=(
main
brackets
pattern
cursor
)
source ${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_USE_ASYNC=true
typeset -g ZSH_AUTOSUGGEST_STRATEGY=(history completion)
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=true

@ -0,0 +1 @@
Subproject commit 8f7e9b2af445ae22bc17918b5e93142799c0a861