2024-06-12 17:29:22 +02:00
|
|
|
# keychain
|
|
|
|
|
zstyle :omz:plugins:keychain agents gpg,ssh
|
|
|
|
|
zstyle :omz:plugins:keychain identities id_rsa id_bearstech D79CA887
|
|
|
|
|
zstyle :omz:plugins:keychain options --quiet
|
|
|
|
|
|
|
|
|
|
# bip at command end, ensure correct window title
|
|
|
|
|
function precmd() {
|
|
|
|
|
echo -n -e "\a"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# history file
|
|
|
|
|
unsetopt share_history
|
|
|
|
|
setopt INC_APPEND_HISTORY
|
|
|
|
|
setopt HIST_EXPIRE_DUPS_FIRST
|
|
|
|
|
HISTSIZE=500000
|
|
|
|
|
SAVEHIST=500000
|
|
|
|
|
|
|
|
|
|
# Disable reserved word foreach
|
|
|
|
|
disable -r foreach
|
|
|
|
|
|
|
|
|
|
# Everyday aliases
|
2024-12-09 18:17:46 +01:00
|
|
|
bt-alerts() {ssh root@${1:-pidou} monshow | grep -v "none$"}
|
|
|
|
|
debian-release() {ssh root@$1 cat /etc/debian_version}
|
2024-06-12 17:29:22 +02:00
|
|
|
dontknow() {echo -n "¯\\_(ツ)_/¯" | xclip}
|
|
|
|
|
e() {emacsclient -n $@ > /dev/null 2>&1}
|
|
|
|
|
tramp() {emacsclient -n $(for x in $@; do echo /root@$x:README; done) > /dev/null 2>&1}
|
|
|
|
|
j() {if [ $# -eq 0 ]; then marks; else jump $@; fi}
|
|
|
|
|
noprompt() {if [ "$PROMPT" != '$ ' ]; then export PROMPT='$ '; export RPROMPT=''; else source ~/.zgen/https-COLON--SLASH--SLASH-gitea.audin.me-SLASH-hybris/zsh-master/hybris.theme; fi}
|
|
|
|
|
open_ports() {if [ $# -eq 1 ] && [ $1 = "public" ]; then sudo netstat -tulpen 2> /dev/null | grep "LISTEN" | grep -v "127.0.0.1"; else sudo netstat -tulpen 2> /dev/null | grep "LISTEN"; fi}
|
|
|
|
|
r() {if [ $# -gt 0 ]; then for h in $@; do ssh root@$h; done; else sudo su -; fi}
|
|
|
|
|
ra() {if [ $# -gt 0 ]; then for h in $@; do ssh -A root@$h; done; else sudo su -; fi}
|
|
|
|
|
|
|
|
|
|
# Usefull bindings
|
|
|
|
|
bindkey "^[Od" backward-word
|
|
|
|
|
bindkey "^[Oc" forward-word
|
|
|
|
|
|
|
|
|
|
# Some exports
|
|
|
|
|
export DISABLE_AUTO_TITLE=true
|
|
|
|
|
export EDITOR=emacsclient
|
2024-12-09 18:17:46 +01:00
|
|
|
export INFRA=/home/${USER}/dev/bearstech/infra
|
2024-06-12 17:29:22 +02:00
|
|
|
export LESS=-cex2MRX
|
|
|
|
|
export LESSOPEN='|~/.lessfilter %s'
|
|
|
|
|
export LOGCHECK=60
|
|
|
|
|
export READNULLCMD=${PAGER:-/usr/bin/pager}
|
|
|
|
|
export WATCH=all
|
|
|
|
|
export WATCHFMT="%n has %a %l from %M"
|
2024-12-09 18:17:46 +01:00
|
|
|
export PATH=$HOME/.scripts:$INFRA/bin:$INFRA/service/xen:$PATH
|
|
|
|
|
|
|
|
|
|
# Some completion functions
|
|
|
|
|
_complete_bt-host() {reply=($(ls $INFRA/host))}
|
|
|
|
|
compctl -K _complete_bt-host bt-dom0
|
|
|
|
|
compctl -K _complete_bt-host infra host
|
|
|
|
|
compctl -K _complete_bt-host bt-release
|
2024-06-12 17:29:22 +02:00
|
|
|
|
|
|
|
|
# Fix for compdef, taken from https://github.com/seletskiy/zsh-zgen-compinit-tweak
|
|
|
|
|
autoload -Uz compinit && compinit -C
|
|
|
|
|
alias compinit='compinit-zgen'
|
|
|
|
|
function compinit-zgen() { grep -q ".zgen" <<< "${@}" && \compinit "${@}" }
|