Update the zsh config to not use oh-my-zsh

This commit is contained in:
Jonny Barnes 2018-01-24 15:26:36 +00:00
parent 76aa4e9504
commit 16a90e60c6
9 changed files with 163 additions and 201 deletions

21
zsh/aliases.zsh Normal file
View file

@ -0,0 +1,21 @@
# aliases.zsh
alias auao="sudo apt update && apt list --upgradable"
alias aupg="sudo apt upgrade"
alias aurup="sudo aura -Akua"
alias bubc="brew upgrade && brew cleanup"
alias bubo="brew update && brew outdated"
alias brewcurl="/usr/local/opt/curl/bin/curl --cacert /usr/local/etc/openssl/cert.pem"
alias brewssl="/usr/local/opt/openssl@1.1/bin/openssl"
alias ga="git add"
alias gf="git fetch --all; git fetch --tags"
alias git="hub"
alias gs="git status"
alias irc="ssh jmb -t '. ~/.zshrc; tmux attach -t irc'"
test $PLATFORM = 'linux' && alias ls="ls -F --color=always"
test $PLATFORM = 'osx' && alias ls="ls -FG"
test $PLATFORM = 'linux' && alias pipup="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo pip install -U"
test $PLATFORM = 'osx' && alias pipup="pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U"
alias rtor="tmux attach -t rtor"
alias startace="acestreamengine --client-console --upload-limit 0 --download-limit 0"
alias up="sudo pacman -Syu"

29
zsh/functions.zsh Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env zsh
# Functions
# Generate TLS certs using a local CA
gencert () {
DOMAIN=$1
test -d /Users/jonny/Development/localCA && ROOT='/Users/jonny/Development/localCA'
test -d /home/jonny/git/ca && ROOT='/home/jonny/git/ca'
test -d /usr/local/opt/openssl@1.1/bin && PATH='/usr/local/opt/openssl@1.1/bin':$PATH
test -f /usr/local/etc/openssl@1.1/openssl.cnf && SSLCNF='/usr/local/etc/openssl@1.1/openssl.cnf'
test -f /etc/ssl/openssl.cnf && SSLCNF='/etc/ssl/openssl.cnf'
cd $ROOT
[[ ! -d $DOMAIN ]] && mkdir $DOMAIN
cd $DOMAIN
[[ -f key ]] && mv key key.bak
[[ -f csr ]] && mv csr csr.bak
[[ -f crt ]] && mv crt crt.bak
openssl ecparam -name secp384r1 -genkey -noout -out key
chmod 644 key
openssl req -new -sha256 -key key -subj "/C=UK/ST=England/L=Darwen/O=JMB Dev Ltd/CN=$DOMAIN" -reqexts SAN -config <(cat $SSLCNF <(printf "[SAN]\nsubjectAltName=DNS:$DOMAIN")) -out csr
openssl x509 -req -in csr -extfile <(cat $SSLCNF <(printf "[SAN]\nsubjectAltName=DNS:$DOMAIN")) -extensions SAN -CA ../jmb-ca-ecc.pem -CAkey ../jmb-ca-ecc.key -CAcreateserial -days 90 -sha256 -out crt
cd $HOME
echo 'Certs generated for $DOMAIN'
}

7
zsh/platform.zsh Normal file
View file

@ -0,0 +1,7 @@
export PLATFORM="unkown"
unamestr=$(uname -s)
if [[ "$unamestr" == 'Linux' ]]; then
export PLATFORM="linux"
elif [[ "$unamestr" == 'Darwin' ]]; then
export PLATFORM="osx"
fi

6
zsh/powerline-prompt.zsh Normal file
View file

@ -0,0 +1,6 @@
# Powerline prompt
powerline-daemon -q
test $PLATFORM = 'osx' \
&& source /usr/local/lib/python3.6/site-packages/powerline/bindings/zsh/powerline.zsh

View file

@ -0,0 +1,5 @@
# ZSH autosuggestions
test -e /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh \
&& source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
test -e /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh \
&& source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

View file

@ -0,0 +1,17 @@
# ZSH substring search
bindKeysZshHistoryOSX() {
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
}
bindKeysZshHistoryLinux() {
zmodload zsh/terminfo
bindkey "$terminfo[cuu1]" history-substring-search-up
bindkey "$terminfo[cud1]" history-substring-search-down
}
test -e /usr/local/opt/zsh-history-substring-search/zsh-history-substring-search.zsh \
&& source /usr/local/opt/zsh-history-substring-search/zsh-history-substring-search.zsh
test -e /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh \
&& source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
test $PLATFORM = 'osx' && bindKeysZshHistoryOSX
test $PLATFORM = 'linux' && bindKeysZshHistoryLinux

View file

@ -0,0 +1,5 @@
# ZSH syntax highlghting
test -e /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh \
&& source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
test -e /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh \
&& source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh