From feddfdd6cab28f55ab2b5597f89f3805bac2349a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 26 Jan 2018 15:51:03 +0100 Subject: Drop bashrc and zshrc They are replaced by shellrc package --- bashrc | 67 ------------------------------------ install | 12 ++----- zshrc | 120 ---------------------------------------------------------------- 3 files changed, 2 insertions(+), 197 deletions(-) delete mode 100644 bashrc delete mode 100644 zshrc diff --git a/bashrc b/bashrc deleted file mode 100644 index 0b7cf08..0000000 --- a/bashrc +++ /dev/null @@ -1,67 +0,0 @@ -# .bashrc - -source ~/.shellrc - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -# Source global definitions -if [ -f /etc/bashrc ]; then - . /etc/bashrc -fi - -# Source all completions -if [ -d ~/.bash_completions ]; then - for F in $(find ~/.bash_completions -type f); do - . "$F" - done -fi - -# PROMPT ####################################################### -PS1='$( -if [ `id -u` -eq "0" ]; then - echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] " -else - echo -n "\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " -fi)' - -PROMPT_COMMAND=' -EC=$? -if [[ $EC < 0 ]]; then - echo -e "\e[1;31m"EXIT: $EC"\e[0m" -elif [[ $EC > 0 ]]; then - echo -e "\e[1;33m"EXIT: $EC"\e[0m" -fi' - -function settitle { - echo -ne "\033]0;`whoami`@`hostname`:`pwd`\007" -} -case "$TERM" in - xterm*|*rxvt*|*st*) - trap 'settitle' DEBUG - ;; -esac - -# Completions ################################################## - -_gitbmerge() { - local cur prev - _init_completion || return - [ $COMP_CWORD -gt 1 ] && return # Complete only single dependency - COMPREPLY=() - local GDIR="$(pwd)" - while [ ! -d "$GDIR/.git" ]; do - [ -z "$GDIR" ] && return - GDIR="${GDIR%/*}" - done - GDIR="$GDIR/.git" - [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory - [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch - local ops="" - for B in "$GDIR"/refs/heads/*; do - # TODO skip branch on HEAD - ops="$ops ${B#$GDIR/refs/heads/}" - done - COMPREPLY+=($(compgen -W "${ops}" -- ${cur})) -} -complete -F _gitbmerge gitbmerge diff --git a/install b/install index bfcab02..40bf40e 100755 --- a/install +++ b/install @@ -13,18 +13,10 @@ git submodule update --init --recursive || (echo "Submodule update failed!"; exi ################################################################################# source private/install # private files, sorry but some privacy is required. -if ask "Install Bashrc"; then - inst bashrc ~/.bashrc - inst shellrc ~/.shellrc +# TODO on hosts without shellrc we might want some thin shellrc to be installed +if ask "Install shell profile"; then inst profile ~/.profile - mkdir -p ~/.bash_completions -fi - -if ask "Install zshrc"; then - inst zshrc ~/.zshrc - inst shellrc ~/.shellrc inst zprofile ~/.zprofile - mkdir -p ~/.zsh_completions fi if ask "Install GIT configuration"; then diff --git a/zshrc b/zshrc deleted file mode 100644 index ec502b6..0000000 --- a/zshrc +++ /dev/null @@ -1,120 +0,0 @@ -source ~/.shellrc - -[[ -o interactive ]] || return # skip on initialization if not interactive - -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 :compinstall filename '/home/kkoci/.zshrc' -zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==32=33}:${(s.:.)LS_COLORS}")' -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} -fpath=(~/.zsh_completions $fpath) - -autoload -Uz compinit && compinit -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 -setopt hist_ignore_dups -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 - -# PROMPT ####################################################### -[ $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 -# 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 -# Completions ################################################## - -_gitbmerge() { - (( CURRENT > 2)) && return # Complete only single dependency - local GDIR="$(pwd)" - while [ ! -d "$GDIR/.git" ]; do - [ -z "$GDIR" ] && return - GDIR="${GDIR%/*}" - done - GDIR="$GDIR/.git" - [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory - [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch - local branches=() - for B in "$GDIR"/refs/heads/*; do - # TODO skip branch on HEAD - branches+=("${B#$GDIR/refs/heads/}") - done - _describe -t branches 'gitbmerge' branches -} -compdef _gitbmerge gitbmerge - -################################################################ -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 -- cgit v1.2.3