dustin
/
zdotdir
Archived
1
0
Fork 0

Initial commit

master
Dustin 2017-01-15 13:23:49 -06:00
commit 7cab8a6bda
10 changed files with 166 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.zcompdump

82
.zshrc Normal file
View File

@ -0,0 +1,82 @@
HISTSIZE=SAVEHIST=10000
HISTFILE=~/.zsh_history
setopt APPEND_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt INTERACTIVE_COMMENTS
export LESSCOLOR=1
export PYTHONWARNINGS=default,ignore::ImportWarning
export NOSE_REDNOSE=1
bindkey "^?" backward-delete-char
bindkey "^W" backward-kill-word
bindkey -M viins "${terminfo[khome]}" beginning-of-line
bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
bindkey -M viins "^[[H" beginning-of-line
bindkey -M vicmd "^[[H" beginning-of-line
bindkey -M viins "${terminfo[kend]}" end-of-line
bindkey -M vicmd "${terminfo[kend]}" end-of-line
bindkey -M viins "^[[F" end-of-line
bindkey -M vicmd "^[[F" end-of-line
bindkey -M viins "^[[1;5C" vi-forward-word
bindkey -M vicmd "^[[1;5C" vi-forward-word
bindkey -M viins "^[[1;5D" vi-backward-word
bindkey -M vicmd "^[[1;5D" vi-backwardword
bindkey -M viins "${terminfo[kdch1]}" vi-delete-char
bindkey -M vicmd "${terminfo[kdch1]}" vi-delete-char
bindkey "^R" history-incremental-search-backward
alias rm='rm -I'
alias ls='LC_COLLATE=C ls -N --color=auto --group-directories-first'
alias g='git status'
alias gc='git diff --cached --color|less -S'
alias gd='git diff --color|less -S'
alias gl='git log --graph --oneline --decorate --date-order --all --color|less -S'
alias gs='git show --stat --patch --color HEAD|less -S'
alias hd='hg diff --color=always|less -S'
alias hl='hg shortlog --graph --color=always|less -S'
alias hs='hg export --color=always|less -S'
alias pep8='PYTHONWARNINGS= pep8'
alias pylint='PYTHONWARNINGS= pylint -rn'
alias flake8='PYTHONWARNINGS= flake8'
alias aws='PYTHONWARNINGS= aws'
alias grep='grep --color=auto'
alias rmrpmbuild='rm -rf BUILD BUILDROOT RPMS SRPMS'
alias apache2='/usr/sbin/apache2 -d ~/.local/lib64/apache2 -f httpd.conf'
alias openconnect='/usr/sbin/openconnect -i vpn0 --juniper --syslog -b --pid-file=/tmp/openconnect.pid -u dhatch ssl.firemon.com'
alias ipsec='/usr/sbin/ipsec'
zstyle ':completion:*:sudo::' environ PATH="/sbin:/usr/sbin:$PATH" HOME="/root"
typeset -U path
typeset -U fpath
fpath[1,0]=~/.zsh/functions
case $TERM in
*xterm*|rxvt)
autoload precmd
;;
esac
autoload kadmin
autoload startrole
autoload switchrealm
autoload vmip
autoload -U compinit promptinit
compinit
promptinit
os=$(. /etc/os-release; echo $ID)
case ${os} in;
gentoo)
prompt gentoo
;;
centos|redhat|rhel)
prompt redhat
;;
esac
unset os

4
README Normal file
View File

@ -0,0 +1,4 @@
Add this line to ~/.zshenv in order to use these ZSH configuration files
without copying/linking them to the "standard" paths:
export ZDOTDIR=${HOME}/.zsh

5
functions/_fmkrb5 Normal file
View File

@ -0,0 +1,5 @@
#compdef fmkrb5
_arguments \
'(-):command: _command_names -e' \
'*::arguments: _normal'

12
functions/kadmin Normal file
View File

@ -0,0 +1,12 @@
# vim: set ft=zsh :
#
kadmin() {
local realm=$(klist | awk -F@ '/Default principal/{print $2}')
if [[ -z ${realm} ]]; then
echo 'could not find realm'
return 1
fi
command kadmin -r ${realm}
}
kadmin "$@"

1
functions/precmd Normal file
View File

@ -0,0 +1 @@
print -Pn "\e]0;%n@%m:%~ (%y%)\a"

6
functions/startrole Normal file
View File

@ -0,0 +1,6 @@
# vim: set ft=zsh :
for arg; do
install -d roles/${arg}/{,tasks,templates,defaults,files,meta,vars,handlers}
touch roles/${arg}/tasks/main.yml
done

51
functions/switchrealm Normal file
View File

@ -0,0 +1,51 @@
# vim: set ft=zsh :
switchrealm() {
local realm principal
case ${1:l} in
s|sp|securepassage.com)
realm=SECUREPASSAGE.COM
localdomain=${realm:l}
principal=dhatch@${realm}
;;
d|dev|dev.cloud.frmn)
realm=DEV.CLOUD.FRMN
localdomain=${realm:l}
principal=dhatch@${realm}
;;
t|test|testing|testing.cloud.frmn)
realm=TESTING.CLOUD.FRMN
localdomain=${realm:l}
principal=dhatch@${realm}
;;
p|prod|prod.cloud.frmn)
realm=PROD.CLOUD.FRMN
localdomain=${realm:l}
principal=dhatch@${realm}
;;
*)
realm=${1}
localdomain=${3:-${realm:l}}
;;
esac
if [[ -z ${realm} ]]; then
unset KRB5CCNAME
unset LOCALDOMAIN
else
cachefile=/tmp/.krb5cc_$(id -u)_${realm}
export KRB5CCNAME=${cachefile}
export LOCALDOMAIN=${localdomain}
if ! klist -s; then
: ${principal:=${2:-${LOGNAME}}}
if [[ ! ${principal} = *@* ]]; then
principal=${principal}@${realm}
fi
kinit ${principal}
fi
fi
klist
}
switchrealm "$@"

2
functions/vi-search-fix Normal file
View File

@ -0,0 +1,2 @@
zle vi-cmd-mode
zle .history-incremental-search-backward

2
functions/vmip Normal file
View File

@ -0,0 +1,2 @@
virsh qemu-agent-command $1 '{"execute":"guest-network-get-interfaces"}' \
| jq -r '.return | .[] | select(.name=="eth0") | .["ip-addresses"] | .[] | select(.["ip-address-type"] == "ipv6" and (.["ip-address"]|startswith("fe80")|not)) | .["ip-address"]'