Major config overhaul

This commit is contained in:
Austen Adler 2016-05-22 13:52:20 -04:00
parent 14287e9cc2
commit 0849fd0f06
2 changed files with 75 additions and 114 deletions

View File

@ -1,30 +1,25 @@
if [ "$TERM" = "xterm-termite" ] ; then
#Termite is in colors, but it doesn't like to tell anyone
export TERM="xterm-256color"
fi
echo -ne '[ ]\r' echo -ne '[ ]\r'
export HISTFILE=$HOME/.zsh_history
for config (~/.zsh/*.zsh) source $config for config (~/.zsh/*.zsh) source $config
ZSH_THEME="af-magic" ZSH_THEME="af-magic"
source "$HOME/.antigen/antigen.zsh" source "$HOME/.antigen/antigen.zsh"
setopt APPEND_HISTORY
HIST_STAMPS="dd.mm.yyyy"
HISTSIZE=12000
SAVEHIST=10000000
setopt INTERACTIVECOMMENTS setopt INTERACTIVECOMMENTS
setopt EXTENDED_GLOB setopt EXTENDED_GLOB
setopt HIST_EXPIRE_DUPS_FIRST setopt HIST_EXPIRE_DUPS_FIRST
export HIST_STAMPS="dd.mm.yyyy"
export HISTSIZE=12000
export SAVEHIST=10000000
export HISTFILE=$HOME/.zsh_history
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY setopt EXTENDED_HISTORY
setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS setopt APPEND_HISTORY SHARE_HISTORY HISTIGNOREALLDUPS
if [ -f /etc/zsh_command_not_found ] ; then
source /etc/zsh_command_not_found
fi
export DISABLE_AUTO_TITLE=true export DISABLE_AUTO_TITLE=true
export EDITOR='vim' export EDITOR='vim'
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
# For pasting in commands that start with $ # For pasting in commands that start with $
$ () { $ () {
$* $*
} }
# A service implementation
sv () { sv () {
command="${@: -1}" command="${@: -1}"
while (( $# > 1 )); do while (( $# > 1 )); do
@ -45,6 +40,7 @@ sv () {
done done
} }
compdef _services sv compdef _services sv
# Run gui application as root by copying xauth credentials
asroot(){ asroot(){
# Use temporary file for added security # Use temporary file for added security
TEMPFILE=$(tempfile) TEMPFILE=$(tempfile)
@ -58,6 +54,7 @@ dsl() {
shift shift
done done
} }
# Remove directory by removing subdirectories up a level
dedir(){ dedir(){
chronic rmdir "$1" -v && return chronic rmdir "$1" -v && return
name=$(uuidgen) name=$(uuidgen)
@ -69,18 +66,10 @@ dedir(){
chronic rmdir -v "$name" chronic rmdir -v "$name"
} }
alias afci='git x ./autoformat.sh;git add --all;git commit -m "Autoformatted"' alias afci='git x ./autoformat.sh;git add --all;git commit -m "Autoformatted"'
alias cpatch='diff -crB'
alias capatch='patch --dry-run -p1 -i'
alias apatch='patch -p1 -i'
alias pg="pcregrep -M"
alias eix="eix -F" alias eix="eix -F"
alias mouse1="xmodmap <(echo pointer = 1 2 3)" alias mouse1="xmodmap <(echo pointer = 1 2 3)"
alias mouse2="xmodmap <(echo pointer = 3 2 1)" alias mouse2="xmodmap <(echo pointer = 3 2 1)"
alias where="readlink -e"
alias ocp="ocp -vs0 -dcurses" alias ocp="ocp -vs0 -dcurses"
alias dumpx="xauth extract /tmp/xauthstuff $DISPLAY"
alias impx="xauth merge /tmp/xauthstuff;rm /tmp/xauthstuff"
alias sudo='sudo '
alias con='git x php app/console' alias con='git x php app/console'
alias srm='srm -dv' alias srm='srm -dv'
alias disphost='export DISPLAY=:0.0' alias disphost='export DISPLAY=:0.0'
@ -88,53 +77,26 @@ alias ll='ls -AlhF'
alias la='ls -A' alias la='ls -A'
alias l='ls -CF' alias l='ls -CF'
alias logout='sudo pkill -u $USER' alias logout='sudo pkill -u $USER'
rsh(){
if [ -z $1 ] ; then
echo "Valid hostnames:"
cat /home/stonewareslord/syncthing/shared/ips
return 1
fi
ADDR=$(cat /home/stonewareslord/syncthing/shared/ips | sed -rne "s/^$1: //pi")
shift
if [ -z $ADDR ] ; then
echo "Hostname not found"
return 2
fi
echo "SSH to $ADDR..."
tsh $ADDR $*
}
fixsh(){
sed -i -e $1"d" ~/.ssh/known_hosts
}
alias tmux='tmux -2' alias tmux='tmux -2'
alias less='less -R' alias less='less -R'
alias tree='tree -C' alias tree='tree -C'
alias skim="(head -5; tail -5) <" alias skim="(head -5; tail -5) <"
alias cp='rsync --partial -ha --info=progress2 "$@"' alias cp='rsync --partial -ha --info=progress2 "$@"'
mv() { /bin/mv -v "$@" }
m() { mv "$@" }
compdef _cp c cfat m mv cp
alias dt='date "+%F %T"'
alias awake='disphost; while true; do xdotool mousemove 0 0; sleep 60; done'
alias adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown'
alias resource='. ~/.zshrc' alias resource='. ~/.zshrc'
alias etup='sudo etc-update'
alias search='apt-cache search'
if [ "$(uname)" != "Darwin" ]; then if [ "$(uname)" != "Darwin" ]; then
# Not Mac # Not Mac
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$(readlink -e ~/bin)" export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$(readlink -e ~/bin)"
alias ls='ls --color=always -F' alias ls='ls --color=always -F'
alias steamo='sudo kill -9 `pidof steam`;sudo unshare -n -- sh -c "ifconfig lo up;sudo -u stonewareslord steam" > /dev/null 2>&1 & disown'
alias matlab='matlab -glnx86' alias matlab='matlab -glnx86'
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"' alias where="readlink -m"
if command -v greadlink 2>&1 >/dev/null; then
alias readlink='greadlink'
fi
else else
# It is a mac
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:~/bin" export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:~/bin"
alias where="echo Can't find mac readlink!"
fi fi
if test -f /etc/gentoo-release; then if test -f /etc/gentoo-release; then
# Gentoo # Gentoo
alias etup='sudo etc-update'
ins(){ ins(){
echo "args: $*" echo "args: $*"
# Beep, verbose, ask # Beep, verbose, ask
@ -178,6 +140,7 @@ elif test -f /etc/lsb-release; then
alias upgrade='sudo apt-get --show-progress upgrade' alias upgrade='sudo apt-get --show-progress upgrade'
alias autoremove='sudo apt-get --show-progress autoremove' alias autoremove='sudo apt-get --show-progress autoremove'
alias updateall='sudo sh -c "apt-get update;apt-get upgrade -y;apt-get dist-upgrade -y;apt-get autoremove -y"' alias updateall='sudo sh -c "apt-get update;apt-get upgrade -y;apt-get dist-upgrade -y;apt-get autoremove -y"'
alias search='apt-cache search'
fi fi
alias ..='k ..' alias ..='k ..'
alias ...='k ../..' alias ...='k ../..'
@ -195,17 +158,25 @@ alias ..............='k ../../../../../../../../../../../../..'
alias ...............='k ../../../../../../../../../../../../../..' alias ...............='k ../../../../../../../../../../../../../..'
alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'" alias ytdl="youtube-dl $@ -x --audio-format mp3 --audio-quality 0 -c -o '%(title)s.%(ext)s'"
alias tux="wemux" alias tux="wemux"
alias g="git $@" alias g="git"
alias stdns="sudo sh -c 'echo nameserver 8.8.8.8 > /etc/resolv.conf'" alias stdns="sudo sh -c 'echo nameserver 8.8.8.8 > /etc/resolv.conf'"
alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\"" alias fvim="vim -u NONE +\"so ~/.vim/plugged/flappyvird-vim/plugin/flappyvird.vim\" +\"so ~/.vim/plugged/flappyvird-vim/autoload/flappyvird.vim\" +\":FlappyVird\" +\":q\""
alias fk='k `fzf --no-mouse -m -1 -x`' alias fk='k `fzf --no-mouse -m -1 -x`'
#alias fkill='ps -ef | sed 1d | fzf --no-mouse -m -1 -x | awk "{print $2}" | xargs kill -${1:-9}'
alias susp="sudo true&&(slock&echo mem | sudo tee /sys/power/state >/dev/null)" alias susp="sudo true&&(slock&echo mem | sudo tee /sys/power/state >/dev/null)"
#alias aoeu='setxkbmap -layout us -option "'
#alias asdf='setxkbmap -layout dvorak -option ""'
alias -g PA='2>&1 | paste' alias -g PA='2>&1 | paste'
alias s='sudo -Hu' alias s='sudo -Hu'
alias sudo='sudo -H' alias -g c='rsync --partial -ha --info=progress2 "$@"'
alias -g cfat='rsync --partial -hrlc --info=progress2 "$@"'
alias -g nify=" > /dev/null 2>&1 &"
alias -g nifyd=" > /dev/null 2>&1 & disown"
alias -g L="2>&1|less"
alias -g G='|& ag'
fixsh(){
sed -i -e $1"d" ~/.ssh/known_hosts
}
mv() { /bin/mv -v "$@" }
m() { mv "$@" }
compdef _cp c cfat m mv cp
paste() { paste() {
NAME="" NAME=""
if [[ ! -z "$1" ]]; then if [[ ! -z "$1" ]]; then
@ -253,13 +224,6 @@ grename() {
echo -n "Command (frneVVVq): " echo -n "Command (frneVVVq): "
done done
} }
alias -g c='rsync --partial -ha --info=progress2 "$@"'
alias -g cfat='rsync --partial -hrlc --info=progress2 "$@"'
alias -g nify=" > /dev/null 2>&1 &"
alias -g nifyd=" > /dev/null 2>&1 & disown"
alias -g L="2>&1|less"
alias -g G='|& ag'
export FZF_COMPLETION_OPTS='--no-mouse -m -1 -x'
bp(){ bp(){
echo '\a' echo '\a'
} }
@ -281,9 +245,6 @@ offline(){
sudo unshare -n -- sudo -u stonewareslord LP_MARK_PREFIX=" $(tput setaf 1)(offline)$(tput sgr0) " zsh sudo unshare -n -- sudo -u stonewareslord LP_MARK_PREFIX=" $(tput setaf 1)(offline)$(tput sgr0) " zsh
fi fi
} }
smon(){
timeout 1s pdsh -R ssh -w 10.0.1.196,10.0.1.207 "$@"
}
dnstest(){ dnstest(){
echo "resolv.conf:" echo "resolv.conf:"
cat /etc/resolv.conf cat /etc/resolv.conf
@ -297,47 +258,6 @@ dnstest(){
echo "Testing DNS" echo "Testing DNS"
curl ifconfig.me curl ifconfig.me
} }
cinitify(){
mkdir $2
cd $2
git init
git remote add origin git@austenwares.com:$1/$2.git
git remote add https https://austenwares.com/gitlab/$1/$2.git
#Offline mode
git remote add oOrigin git@10.0.1.200:$1/$2.git
git remote add oHttps https://10.0.1.200/gitlab/$1/$2.git
git remote -v
git config http.sslVerify false
if [[ $3 == "-v" ]] ; then
# Vagrant repository
vagrant init $4
echo ".vagrant" > .gitignore
git add .
git commit -m "Initial commit"
vagrant up
elif [[ ! $3 == "-r" ]] ; then
echo -n "Pull from: "
read from
git pull $from
git checkout master
fi
}
initify(){
git init
git remote add origin git@austenwares.com:$1/$2.git
git remote add https https://austenwares.com/gitlab/$1/$2.git
#Offline mode
git remote add oOrigin git@10.0.1.200:$1/$2.git
git remote add oHttps https://10.0.1.200/gitlab/$1/$2.git
git remote -v
git config http.sslVerify false
if [[ ! $3 == "-r" ]] ; then
echo -n "Pull from: "
read from
git pull $from
git checkout master
fi
}
tsh(){ tsh(){
ssh -X $* ssh -X $*
if which ponysay >/dev/null; then if which ponysay >/dev/null; then
@ -464,6 +384,7 @@ k(){
#Extract if it's extractable #Extract if it's extractable
case $1 in case $1 in
*.tar.xz) pv $1|tar -xJf - ;; *.tar.xz) pv $1|tar -xJf - ;;
*.txz) pv $1|tar -xJf - ;;
*.tar.bz2) pv $1|tar -xjf - ;; *.tar.bz2) pv $1|tar -xjf - ;;
*.tar.gz) pv $1|tar -xzf - ;; *.tar.gz) pv $1|tar -xzf - ;;
*.tar) pv $1|tar -xf - ;; *.tar) pv $1|tar -xf - ;;
@ -487,15 +408,14 @@ k(){
vim "$@" vim "$@"
fi fi
} }
#source ~/.zsh/*.zsh
# To resize, # To resize,
# :%S/\[([# ]{9})\]/[\1 ] # :%S/\[([# ]{9})\]/[\1 ]
echo -ne '[# ]\r' echo -ne '[# ]\r'
antigen bundle stonewareslord/omg antigen bundle https://austenwares.com/gogs/stonewareslord/omg
echo -ne '[## ]\r' echo -ne '[## ]\r'
antigen theme stonewareslord/oh-my-git-themes af-magic antigen theme https://austenwares.com/gogs/stonewareslord/oh-my-git-themes af-magic
echo -ne '[### ]\r' echo -ne '[### ]\r'
antigen bundle stonewareslord/lpr antigen bundle https://austenwares.com/gogs/stonewareslord/lpr
echo -ne '[#### ]\r' echo -ne '[#### ]\r'
antigen bundle zsh-users/zsh-syntax-highlighting antigen bundle zsh-users/zsh-syntax-highlighting
echo -ne '[##### ]\r' echo -ne '[##### ]\r'
@ -508,3 +428,42 @@ echo
(( $+TMUX )) && unset zle_bracketed_paste (( $+TMUX )) && unset zle_bracketed_paste
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
#Old config options that are no longer in use
#alias cpatch='diff -crB'
#alias capatch='patch --dry-run -p1 -i'
#alias apatch='patch -p1 -i'
#alias pg="pcregrep -M"
#if command -v greadlink 2>&1 >/dev/null; then
# alias readlink='greadlink'
#fi
#alias dumpx="xauth extract /tmp/xauthstuff $DISPLAY"
#alias impx="xauth merge /tmp/xauthstuff;rm /tmp/xauthstuff"
#alias sudo='sudo '
#rsh(){
# if [ -z $1 ] ; then
# echo "Valid hostnames:"
# cat /home/stonewareslord/syncthing/shared/ips
# return 1
# fi
# ADDR=$(cat /home/stonewareslord/syncthing/shared/ips | sed -rne "s/^$1: //pi")
# shift
# if [ -z $ADDR ] ; then
# echo "Hostname not found"
# return 2
# fi
# echo "SSH to $ADDR..."
# tsh $ADDR $*
#}
#alias dt='date "+%F %T"'
#alias awake='disphost; while true; do xdotool mousemove 0 0; sleep 60; done'
#alias adk='/home/stonewareslord/Applications/adk/bin/studio.sh & disown'
#alias steamo='sudo kill -9 `pidof steam`;sudo unshare -n -- sh -c "ifconfig lo up;sudo -u stonewareslord steam" > /dev/null 2>&1 & disown'
#alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
#alias fkill='ps -ef | sed 1d | fzf --no-mouse -m -1 -x | awk "{print $2}" | xargs kill -${1:-9}'
#alias aoeu='setxkbmap -layout us -option "'
#alias asdf='setxkbmap -layout dvorak -option ""'
#alias sudo='sudo -H'
#smon(){
# timeout 1s pdsh -R ssh -w 10.0.1.196,10.0.1.207 "$@"
#}

View File

@ -275,7 +275,7 @@ endif
"Adds snippets | https://github.com/sirver/UltiSnips "Adds snippets | https://github.com/sirver/UltiSnips
Plug 'honza/vim-snippets' Plug 'honza/vim-snippets'
"More snippets | https://github.com/honza/vim-snippets "More snippets | https://github.com/honza/vim-snippets
"Plug 'othree/eregex.vim' Plug 'othree/eregex.vim'
"Real regexes in vim | https://github.com/othree/eregex.vim "Real regexes in vim | https://github.com/othree/eregex.vim
Plug 'mhinz/vim-signify' Plug 'mhinz/vim-signify'
"Git information inline | https://github.com/mhinz/vim-signify "Git information inline | https://github.com/mhinz/vim-signify
@ -284,14 +284,16 @@ endif
Plug 'https://github.com/Valloric/YouCompleteMe' Plug 'https://github.com/Valloric/YouCompleteMe'
"Autocompletion | https://github.com/Valloric/YouCompleteMe "Autocompletion | https://github.com/Valloric/YouCompleteMe
Plug 'https://austenwares.com/gogs/vim/vim-java-getset.git' Plug 'https://austenwares.com/gogs/vim/vim-java-getset.git'
"Java getters and setters| gogs@austenwares.com:stonewareslord/vim-java-getset.git "Java getters and setters| https://austenwares.com/gogs/vim/vim-java-getset.git
Plug 'https://austenwares.com/gogs/vim/double-tap.git'
"Double tap for comments
" } " }
" Style { " Style {
Plug 'nathanaelkane/vim-indent-guides' Plug 'nathanaelkane/vim-indent-guides'
"Indentation guides | https://github.com/nathanaelkane/vim-indent-guides "Indentation guides | https://github.com/nathanaelkane/vim-indent-guides
Plug 'bling/vim-airline' Plug 'bling/vim-airline'
"Bottom status bar | https://github.com/bling/vim-airline "Bottom status bar | https://github.com/bling/vim-airline
Plug 'stonewareslord/vim-colors' Plug 'https://austenwares.com/gogs/vim/vim-colors'
"Theme pack | https://github.com/spf13/vim-colors "Theme pack | https://github.com/spf13/vim-colors
Plug 'godlygeek/csapprox' Plug 'godlygeek/csapprox'
"256 color vim in terminal | https://github.com/godlygeek/csapprox "256 color vim in terminal | https://github.com/godlygeek/csapprox