From d31941c80cb7f1ff774d289542806de564dda09f Mon Sep 17 00:00:00 2001 From: Nikolas Weger Date: Sun, 6 Sep 2020 13:52:58 +0200 Subject: [PATCH] refactored some stuff --- zsh/files/completion.zsh | 7 ++++ zsh/{ => files}/dircolor.zsh | 0 .../{key-bindings.zsh => keybindings.zsh} | 34 +++++++++++++++++++ zsh/rc.zsh | 15 +++++--- 4 files changed, 51 insertions(+), 5 deletions(-) rename zsh/{ => files}/dircolor.zsh (100%) rename zsh/files/{key-bindings.zsh => keybindings.zsh} (57%) diff --git a/zsh/files/completion.zsh b/zsh/files/completion.zsh index ff2942c..95019a7 100644 --- a/zsh/files/completion.zsh +++ b/zsh/files/completion.zsh @@ -1,5 +1,7 @@ zmodload -i zsh/complist +WORDCHARS='' + unsetopt menu_complete unsetopt flowcontrol setopt auto_menu @@ -18,8 +20,13 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories +zstyle ':completion::complete:*' use-cache 1 +zstyle ':completion::complete:*' cache-path "$HOME/.cache/zsh/compcache/" + 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 '*' single-ignored show + 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 diff --git a/zsh/dircolor.zsh b/zsh/files/dircolor.zsh similarity index 100% rename from zsh/dircolor.zsh rename to zsh/files/dircolor.zsh diff --git a/zsh/files/key-bindings.zsh b/zsh/files/keybindings.zsh similarity index 57% rename from zsh/files/key-bindings.zsh rename to zsh/files/keybindings.zsh index 7d943cf..712c5d8 100644 --- a/zsh/files/key-bindings.zsh +++ b/zsh/files/keybindings.zsh @@ -1,3 +1,20 @@ +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init() { + echoti smkx + } + function zle-line-finish() { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish +fi + +bindkey -e + +bindkey '\ew' kill-region +bindkey -s '\el' 'ls\n' +bindkey '^r' history-incremental-search-backward + if [[ "${terminfo[kpp]}" != "" ]]; then bindkey "${terminfo[kpp]}" up-line-or-history fi @@ -26,6 +43,17 @@ if [[ "${terminfo[kend]}" != "" ]]; then bindkey "${terminfo[kend]}" end-of-line fi +bindkey ' ' magic-space + +bindkey '^[[1;5C' forward-word +bindkey '^[[1;5D' backward-word + +if [[ "${terminfo[kcbt]}" != "" ]]; then + bindkey "${terminfo[kcbt]}" reverse-menu-complete +fi + +bindkey '^?' backward-delete-char + if [[ "${terminfo[kdch1]}" != "" ]]; then bindkey "${terminfo[kdch1]}" delete-char else @@ -33,3 +61,9 @@ else bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char fi + +autoload -U edit-command-line +zle -N edit-command-line +bindkey '\C-x\C-e' edit-command-line + +bindkey "^[m" copy-prev-shell-word diff --git a/zsh/rc.zsh b/zsh/rc.zsh index 45309f1..da0de17 100644 --- a/zsh/rc.zsh +++ b/zsh/rc.zsh @@ -1,20 +1,25 @@ export path=($path $HOME/.config/dotfiles/bin) export fpath=($fpath $ZDOTDIR/local/fpath) -source "$ZDOTDIR/dircolor.zsh" - -source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh - mkdir -p $HOME/.cache/zsh autoload -Uz compinit bashcompinit compinit -d $HOME/.cache/zsh/compdump bashcompinit -for file in $ZDOTDIR/files/*.zsh; do source "$file"; done +source $ZDOTDIR/files/dircolor.zsh +source $ZDOTDIR/files/aliases.zsh +source $ZDOTDIR/files/completion.zsh +source $ZDOTDIR/files/history.zsh +source $ZDOTDIR/files/keybindings.zsh +source $ZDOTDIR/files/termsupport.zsh +source $ZDOTDIR/files/cnf.zsh +source $ZDOTDIR/files/fzf.zsh [[ -f "$ZDOTDIR/local/rc.zsh" ]] && source "$ZDOTDIR/local/rc.zsh" +source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh export STARSHIP_CONFIG=$ZDOTDIR/starship.toml eval "$(starship init zsh)" +eval "$(direnv hook zsh)"