diff options
Diffstat (limited to 'zshrc.d')
-rw-r--r-- | zshrc.d/bell | 37 | ||||
-rw-r--r-- | zshrc.d/common | 23 | ||||
-rw-r--r-- | zshrc.d/completion | 11 | ||||
-rw-r--r-- | zshrc.d/prompt | 17 | ||||
-rw-r--r-- | zshrc.d/shellrc | 5 | ||||
-rw-r--r-- | zshrc.d/title | 12 |
6 files changed, 105 insertions, 0 deletions
diff --git a/zshrc.d/bell b/zshrc.d/bell new file mode 100644 index 0000000..5fbb5c4 --- /dev/null +++ b/zshrc.d/bell @@ -0,0 +1,37 @@ +# vim: ft=zsh +# Long running bell +# Inspired by: https://gist.github.com/jpouellet/5278239 + +zmodload zsh/datetime # load $EPOCHSECONDS builtin +autoload -Uz add-zsh-hook +lrbell_duration=15 +lrbell_timestamp=$EPOCHSECONDS +lrbell_window_id=0x0 + +lrbell_active_window_id() { + xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2 +} + +lrbell_begin() { + lrbell_timestamp=$EPOCHSECONDS + if [ -n "$DISPLAY" ]; then + lrbell_message="`pwd`: $1" + lrbell_window_id="$(lrbell_active_window_id)" + fi +} + +lrbell_end() { + if (( $EPOCHSECONDS - $lrbell_timestamp < $lrbell_duration )); then + return + fi + + print -n '\a' + if [ -n "$DISPLAY" ] && [ -n "$lrbell_window_id" ]; then # notify only if running in X + if [ "$(lrbell_active_window_id)" != "$lrbell_window_id" ]; then # And active window isn't current one + notify-send "Command finished" "$lrbell_message" + fi + fi +} + +add-zsh-hook preexec lrbell_begin +add-zsh-hook precmd lrbell_end diff --git a/zshrc.d/common b/zshrc.d/common new file mode 100644 index 0000000..9ba1466 --- /dev/null +++ b/zshrc.d/common @@ -0,0 +1,23 @@ +# vim: ft=zsh + +autoload -Uz colors && colors + +HISTFILE=~/.histfile +HISTSIZE=10000 +SAVEHIST=10000 +setopt appendhistory +setopt extendedglob +setopt hist_ignore_dups +setopt hist_expire_dups_first +setopt extended_history +setopt inc_append_history +setopt promptsubst +unsetopt nomatch +bindkey -e + +autoload -U select-word-style +select-word-style bash + +# Delete key workaround +bindkey "^[[3~" delete-char +bindkey "^[3;5~" delete-char diff --git a/zshrc.d/completion b/zshrc.d/completion new file mode 100644 index 0000000..595489c --- /dev/null +++ b/zshrc.d/completion @@ -0,0 +1,11 @@ +# vim: ft=zsh + +zstyle ':completion:*' completer _expand _complete _ignored _approximate +zstyle ':completion:*' insert-unambiguous true +zstyle ':completion:*' max-errors 3 +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path ~/.cache/zsh +zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==32=33}:${(s.:.)LS_COLORS}")' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +autoload -Uz compinit && compinit diff --git a/zshrc.d/prompt b/zshrc.d/prompt new file mode 100644 index 0000000..07437b1 --- /dev/null +++ b/zshrc.d/prompt @@ -0,0 +1,17 @@ +# vim: ft=zsh + +[ $UID -eq 0 ] && NCOLOR="red" || NCOLOR="green" +PROMPT="%(?..%{$fg_bold[yellow]%}EXIT: %? +)%{$fg_bold[$NCOLOR]%}%n@%m:%{$fg_bold[blue]%}%1~%{$fg_bold[$NCOLOR]%}%(!.#.$)%{$reset_color%} " +unset NCOLOR + +if [ -e ~/.local/git-prompt.sh ]; then + source ~/.local/git-prompt.sh + export GIT_PS1_SHOWDIRTYSTATE=y + export GIT_PS1_SHOWUNTRACKEDFILES=y + export GIT_PS1_SHOWUPSTREAM="auto" + export GIT_PS1_STATESEPARATOR="" + export GIT_PS1_SHOWUPSTREAM=y + export GIT_PS1_DESCRIBE_STYLE="branch" + RPROMPT='$(__git_ps1 "%s")' +fi diff --git a/zshrc.d/shellrc b/zshrc.d/shellrc new file mode 100644 index 0000000..b3162f7 --- /dev/null +++ b/zshrc.d/shellrc @@ -0,0 +1,5 @@ +# vim: ft=zsh + +for sh in /etc/shellrc.d/*; do + [ -r "$sh" ] && . "$sh" +done diff --git a/zshrc.d/title b/zshrc.d/title new file mode 100644 index 0000000..18b19d1 --- /dev/null +++ b/zshrc.d/title @@ -0,0 +1,12 @@ +# vim: ft=zsh + +case "$TERM" in + xterm*|*rxvt*|*st*) + precmd() { + print -Pn "\e]0;%n@%m:%~ %(1j,%j job%(2j|s|) ,)\a" + } + preexec() { + print -Pn "\e]0;%n@%m:%~ !$1\a" + } + ;; +esac |