refactored some stuff

This commit is contained in:
Nikolas Weger 2020-09-04 20:52:41 +02:00
parent e007eb5a58
commit 5f3ecf6090
29 changed files with 91 additions and 666 deletions

19
zsh/files/aliases.zsh Normal file
View file

@ -0,0 +1,19 @@
alias ls='exa -al --color=always --group-directories-first'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias grep="grep --exclude-dir={.bzr,CVS,.git,.hg,.svn} --color=auto"
alias sc-status="sudo systemctl status"
alias sc-start="sudo systemctl start"
alias sc-stop="sudo systemctl stop"
alias sc-reload="sudo systemctl reload"
alias sc-restart="sudo systemctl restart"
alias sc-enable="sudo systemctl enable"
alias sc-disable="sudo systemctl disable"
alias sc-daemon-reload="sudo systemctl daemon-reload"
alias duplHostKeys='cat ~/.ssh/known_hosts | egrep -v "mesh.eu|inetbone.net" | cut -d" " -f3 | sort | uniq -d'
alias tb="nc termbin.com 9999"

18
zsh/files/cnf.zsh Normal file
View file

@ -0,0 +1,18 @@
[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
if [ -f /usr/libexec/pk-command-not-found ]; then
command_not_found_handler () {
runcnf=1
retval=127
[ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
[ ! -x /usr/libexec/packagekitd ] && runcnf=0
if [ $runcnf -eq 1 ]
then
/usr/libexec/pk-command-not-found $@
retval=$?
fi
return $retval
}
fi

30
zsh/files/completion.zsh Normal file
View file

@ -0,0 +1,30 @@
zmodload -i zsh/complist
unsetopt menu_complete
unsetopt flowcontrol
setopt auto_menu
setopt complete_in_word
setopt always_to_end
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
zstyle ':completion:*:*:*:users' ignored-patterns adm amanda apache at avahi avahi-autoipd backup beaglidx bin bitcoin bitwarden_rs cacti canna clamav ceph colord consul couchdb cups daemon dbus dhcp dhcpcd distcache dnsdist dnsmasq dovecot eeleater elasticsearch fax flatpak flaskdemo ftp games gdm geoclue git gitea gkrellmd gluster gopher gophernicus gnats hacluster haldaemon halt hsqldb http ident irc junkbust kdm kibana landscape ldap lightdm list lldpd logstash lp lxd mail mailman mailnull man mattermost messagebus mldonkey mongodb mxisd mysql nagios named netdata netdump news nfsnobody nm-openvpn nobody nscd ntp nut nvidia-persistenced nweger nx obsrun openvpn operator pcap pcp polkitd pollinate postfix postgres powerdns privoxy proxy pulse prosody puppet pvm quagga radiusd radvd redis rpc rpcuser rpm rtkit root scard sddm shutdown smmsp squid sshd statd stunnel svn synapse sync sys syslog systemd-coredump systemd-journal-remote systemd-network systemd-resolve systemd-timesync tcpdump teamspeak tftp tinyproxy tor transmission tss turnserver usbmux unbound uucp uuidd vault vcsa webvirtmgr wildfly wwwrun www-data xfs youtrack zabbix-agent zabbix-server zabbix zerotier-one zerotier '_*'
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost megumi _gateway pxm
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' '*.eeleater.org' '*sublime*' '*.local'
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'

19
zsh/files/fzf.zsh Normal file
View file

@ -0,0 +1,19 @@
fzfComp=""
fzfKeyb=""
if [[ $os == "arch" ]]; then
fzfComp="/usr/share/fzf/completion.zsh"
fzfKeyb="/usr/share/fzf/key-bindings.zsh"
fi
if [[ $os == "debian" || $os == "ubuntu" || $os == "kali" ]]; then
fzfComp="/usr/share/doc/fzf/examples/completion.zsh"
fzfKeyb="/usr/share/doc/fzf/examples/key-bindings.zsh"
fi
if [[ $os == "fedora" ]]; then
fzfKeyb="/usr/share/fzf/shell/key-bindings.zsh"
fi
source $fzfComp &>/dev/null
source $fzfKeyb &>/dev/null

11
zsh/files/history.zsh Normal file
View file

@ -0,0 +1,11 @@
HISTSIZE=50000
SAVEHIST=20000
HISTFILE=$HOME/.cache/zsh/history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history

View file

@ -0,0 +1,35 @@
if [[ "${terminfo[kpp]}" != "" ]]; then
bindkey "${terminfo[kpp]}" up-line-or-history
fi
if [[ "${terminfo[knp]}" != "" ]]; then
bindkey "${terminfo[knp]}" down-line-or-history
fi
if [[ "${terminfo[kcuu1]}" != "" ]]; then
autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
fi
if [[ "${terminfo[kcud1]}" != "" ]]; then
autoload -U down-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
fi
if [[ "${terminfo[khome]}" != "" ]]; then
bindkey "${terminfo[khome]}" beginning-of-line
fi
if [[ "${terminfo[kend]}" != "" ]]; then
bindkey "${terminfo[kend]}" end-of-line
fi
if [[ "${terminfo[kdch1]}" != "" ]]; then
bindkey "${terminfo[kdch1]}" delete-char
else
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
fi

44
zsh/files/termsupport.zsh Normal file
View file

@ -0,0 +1,44 @@
function title {
emulate -L zsh
setopt prompt_subst
[[ "$EMACS" == *term* ]] && return
: ${2=$1}
case "$TERM" in
cygwin|xterm*|putty*|rxvt*|ansi)
print -Pn "\e]2;$2:q\a"
print -Pn "\e]1;$1:q\a"
;;
screen*|tmux*)
print -Pn "\ek$1:q\e\\"
;;
*)
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
echoti tsl
print -Pn "$1"
echoti fsl
fi
;;
esac
}
function omz_termsupport_precmd {
emulate -L zsh
title '%15<..<%~%<<' '%n@%m: %~'
}
function omz_termsupport_preexec {
emulate -L zsh
setopt extended_glob
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
local LINE="${2:gs/%/%%}"
title '$CMD' '%100>...>$LINE%<<'
}
precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)