Created
March 7, 2023 00:47
-
-
Save raininja/ea28e72dd003673c942da1d9769be989 to your computer and use it in GitHub Desktop.
my zsh config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# psibyrions zshrc Sun Sep 14 12:54:24 CDT 2008 | |
# | |
# | |
ZSH=/usr/share/oh-my-zsh | |
# source $ZSH/oh-my-zsh.sh | |
[[ $TTY == "/dev/tty2" ]] && exec startx | |
prepend() { [ -d "$2" ] && eval $1=\"$2\$\{$1:+':'\$$1\}\" && export $1 ; } | |
HISTFILE=~/.histfile | |
HISTSIZE=20000 | |
SAVEHIST=20000 | |
# Where to look for autoloaded function definitions | |
fpath=($fpath ~/.zfunc) | |
# configure fontconfig | |
export FONTCONFIG_PATH=/etc/fonts | |
autoload -U compinit | |
compinit | |
# Completion Styles | |
# vex2 virtualenv completions | |
# eval "$(vex2 --shell-config zsh)" | |
# list of completers to use | |
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate | |
# attempt to color ls | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
# allow one error for every three characters typed in approximate completer | |
zstyle -e ':completion:*:approximate:*' max-errors \ | |
'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )' | |
# insert all expansions for expand completer | |
zstyle ':completion:*:expand:*' tag-order all-expansions | |
# formatting and messages | |
zstyle ':completion:*' verbose yes | |
zstyle ':completion:*:descriptions' format '%B%d%b' | |
zstyle ':completion:*:messages' format '%d' | |
zstyle ':completion:*:warnings' format 'No matches for: %d' | |
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' | |
zstyle ':completion:*' group-name '' | |
# match uppercase from lowercase | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' | |
# offer indexes before parameters in subscripts | |
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters | |
# command for process lists, the local web server details and host completion | |
#zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args' | |
#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html' | |
zstyle ':completion:*:urls' local 'www' '/srv/http/' 'public_html' hosts $hosts | |
# Filename suffixes to ignore during completion (except after rm command) | |
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \ | |
'*?.old' '*?.pro' | |
# the same for old style completion | |
#fignore=(.o .c~ .old .pro) | |
# ignore completion functions (until the _ignored completer) | |
zstyle ':completion:*:functions' ignored-patterns '_*' | |
# ssh-agent | |
zstyle ':omz:plugins:ssh-agent' identities 'id_rsa' 'aur' 'id_' | |
zstyle ':omz:plugins:ssh-agent' lifetime 4h | |
plugins=(archlinux encode64 systemd google yarn wd history-substring-search \ | |
jsontools common-aliases per-directory-history) | |
#alias ls='ls --color=auto -F -alh -si -S --group-directories-first' | |
alias nano='nano -w' | |
alias df='df -H' | |
alias susds='sudo systemctl start' | |
alias susdr='sudo systemctl restart' | |
alias susdst='sudo systemctl status' | |
alias susd='sudo systemctl' | |
#alias flashpeak-slimjet='flashpeak-slimjet --force-device-scale-factor=2' | |
#alias cqb='et +set fs_game cqbtest +set com_hunkmegs 256' | |
#alias omo='/home/raijin/momonga/trunk/tools/OmoiKondara -vi' | |
#alias packer='packer --noconfirm --noedit' | |
#------------------------------ | |
# Prompt | |
#------------------------------ | |
setprompt () { | |
# load some modules | |
autoload -U colors zsh/terminfo # Used in the colour alias below | |
colors | |
setopt prompt_subst | |
# make some aliases for the colours: (could use normal escap.seq's too) | |
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do | |
eval PR_$color='%{$fg[${(L)color}]%}' | |
done | |
PR_NO_COLOR="%{$terminfo[sgr0]%}" | |
# Check the UID | |
if [[ $UID -ge 1000 ]]; then # normal user | |
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}' | |
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}' | |
elif [[ $UID -eq 0 ]]; then # root | |
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}' | |
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}' | |
fi | |
#check for python virtualenv | |
if [ -n "$VIRTUAL_ENV" ]; then | |
eval PR_VENV=${VIRTUAL_ENV##*/} | |
fi | |
# set the prompt | |
if [ -n "$VIRTUAL_ENV" ]; then | |
PS1=$'${PR_RED}<${PR_WHITE}${PR_VENV}${PR_RED}>${PR_CYAN}[${PR_USER}${PR_CYAN}@${PR_YELLOW}%m${PR_CYAN}][${PR_BLUE}%~${PR_CYAN}]${PR_USER_OP}' | |
else PS1=$'${PR_CYAN}[${PR_USER}${PR_CYAN}@${PR_YELLOW}%m${PR_CYAN}][${PR_BLUE}%~${PR_CYAN}]${PR_USER_OP}' | |
fi | |
PS2=$'%_>' | |
} | |
setprompt | |
#distcc config | |
#CONCURRENCY_LEVEL=40 | |
#DISTCC_HOSTS="silmaril" | |
#PATH="/usr/local/distcc/bin:${PATH}" | |
#export CONCURRENCY_LEVEL DISTCC_HOSTS PATH | |
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |
PATH=$HOME/bin:$PATH | |
PATH=$PATH:$HOME/.config/composer/vendor/bin | |
## CCACHE | |
export USE_CCACHE=1 | |
export CCACHE_DIR=/home/raijin/ccache/.ccache | |
aa_mod_parameters () { | |
N=/dev/null; | |
C=`tput op` O=$(echo -en "\n`tput setaf 2`>>> `tput op`"); | |
for mod in $(cat /proc/modules|cut -d" " -f1); | |
do | |
md=/sys/module/$mod/parameters; | |
[[ ! -d $md ]] && continue; | |
m=$mod; | |
d=`modinfo -d $m 2>$N | tr "\n" "\t"`; | |
echo -en "$O$m$C"; | |
[[ ${#d} -gt 0 ]] && echo -n " - $d"; | |
echo; | |
for mc in $(cd $md; echo *); | |
do | |
de=`modinfo -p $mod 2>$N | grep ^$mc 2>$N|sed "s/^$mc=//" 2>$N`; | |
echo -en "\t$mc=`cat $md/$mc 2>$N`"; | |
[[ ${#de} -gt 1 ]] && echo -en " - $de"; | |
echo; | |
done; | |
done | |
} | |
#source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
#source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
export QT_SCALE_FACTOR=2 | |
export GDK_SCALE=2 | |
#export QT_SCALE_FACTOR=1 | |
#export GDK_SCALE=1 | |
# wayland qt support | |
#export QT_QPA_PLATFORM=wayland-egl | |
#source /usr/share/nvm/init-nvm.sh | |
# better ls | |
if ls --color -d . >/dev/null 2>&1; then # GNU ls | |
export COLUMNS # Remember columns for subprocesses. | |
eval "$(dircolors)" | |
function ls { | |
command ls -F -h --color=always -v --author --time-style=long-iso -C "$@" | less -R -X -F | |
} | |
function lls { | |
LLS_PATH=$1 | |
command ls -AHl -F -h --color=always -v --author --time-style=long-iso -C "$@" | awk "{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\"%0o \",k);print}" \ | |
| less -R -X -F | |
} | |
alias ll='lls -l -a' | |
alias l='lls -l -a' | |
fi | |
#google cloud platform | |
#source /opt/google-cloud-sdk/path.bash.inc | |
#source /opt/google-cloud-sdk/completion.bash.inc | |
#autoload bashcompinit | |
#bashcompinit | |
#source /home/raijin/wp-completion.bash | |
# node | |
PATH="$HOME/.node_modules/bin:$PATH" | |
export npm_config_prefix=~/.node_modules | |
[[ -s "/home/raijin/.gvm/scripts/gvm" ]] && source "/home/raijin/.gvm/scripts/gvm" | |
# yarn | |
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" | |
# command not found | |
#source /usr/share/doc/pkgfile/command-not-found.zsh | |
#ttyctl to auto reset terminals | |
ttyctl -f | |
# dirstack | |
DIRSTACKFILE="$HOME/.cache/zsh/dirs" | |
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then | |
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) | |
[[ -d $dirstack[1] ]] && cd $dirstack[1] | |
fi | |
chpwd() { | |
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE | |
} | |
DIRSTACKSIZE=20 | |
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME | |
## Remove duplicate entries | |
setopt PUSHD_IGNORE_DUPS | |
## This reverts the +/- operators. | |
setopt PUSHD_MINUS | |
[[ -s /home/denkijin/.autojump/etc/profile.d/autojump.sh ]] && source /home/denkijin/.autojump/etc/profile.d/autojump.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment