dotfiles

A steaming hot pile of sh...ell scripts and configuration files.
git clone https://kaka.farm/~git/dotfiles
Log | Files | Refs

.bashrc (5837B)


      1 #!/bin/bash
      2 
      3 # ~/.bashrc: executed by bash(1) for non-login shells.
      4 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
      5 # for examples
      6 
      7 export LC_ALL=en_US.UTF-8
      8 export LANG=en_US.UTF-8
      9 export LANGUAGE=en_US.UTF-8
     10 
     11 export ALTERNATE_EDITOR=""
     12 
     13 # ~/.bashrc: executed by bash(1) for non-login shells.
     14 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
     15 # for examples
     16 
     17 if [ -d "$HOME/.local/bin" ] ; then
     18         export PATH="$HOME/.local/bin:$PATH"
     19 fi
     20 
     21 if [ -d "$HOME/bin" ] ; then
     22         export PATH="$HOME/bin:$PATH"
     23 fi
     24 
     25 # If not running interactively, don't do anything
     26 case $- in
     27     *i*) ;;
     28     *) return;;
     29 esac
     30 
     31 # don't put duplicate lines or lines starting with space in the history.
     32 # See bash(1) for more options
     33 HISTCONTROL=ignoreboth
     34 
     35 # append to the history file, don't overwrite it
     36 shopt -s histappend
     37 
     38 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
     39 HISTSIZE=1000
     40 HISTFILESIZE=2000
     41 
     42 # check the window size after each command and, if necessary,
     43 # update the values of LINES and COLUMNS.
     44 shopt -s checkwinsize
     45 
     46 # If set, the pattern "**" used in a pathname expansion context will
     47 # match all files and zero or more directories and subdirectories.
     48 #shopt -s globstar
     49 
     50 # make less more friendly for non-text input files, see lesspipe(1)
     51 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
     52 
     53 # set variable identifying the chroot you work in (used in the prompt below)
     54 [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ] && debian_chroot="$(cat /etc/debian_chroot)"
     55 
     56 # set a fancy prompt (non-color, unless we know we "want" color)
     57 case "$TERM" in
     58     xterm-color|*-256color) color_prompt=yes;;
     59 esac
     60 
     61 # uncomment for a colored prompt, if the terminal has the capability; turned
     62 # off by default to not distract the user: the focus in a terminal window
     63 # should be on the output of commands, not on the prompt
     64 force_color_prompt=yes
     65 
     66 if [ -n "${force_color_prompt}" ]; then
     67     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
     68         # We have color support; assume it's compliant with Ecma-48
     69         # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
     70         # a case would tend to support setf rather than setaf.)
     71         color_prompt=yes
     72     else
     73         color_prompt=
     74     fi
     75 fi
     76 
     77 if [ "$color_prompt" = yes ]; then
     78     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
     79 else
     80     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
     81 fi
     82 unset color_prompt force_color_prompt
     83 
     84 # If this is an xterm set the title to user@host:dir
     85 case "$TERM" in
     86 xterm*|rxvt*)
     87     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
     88     ;;
     89 *)
     90     ;;
     91 esac
     92 
     93 # enable color support of ls and also add handy aliases
     94 if [ -x /usr/bin/dircolors ]; then
     95     if [ -r ~/.dircolors ];
     96     then
     97         eval "$(dircolors -b ~/.dircolors)"
     98     else
     99         eval "$(dircolors -b)"
    100     fi
    101     alias ls='ls --color=auto'
    102     #alias dir='dir --color=auto'
    103     #alias vdir='vdir --color=auto'
    104 
    105     alias grep='grep --color=auto'
    106     alias fgrep='fgrep --color=auto'
    107     alias egrep='egrep --color=auto'
    108 fi
    109 
    110 # colored GCC warnings and errors
    111 #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
    112 
    113 # some more ls aliases
    114 alias ll='ls -alF'
    115 alias la='ls -A'
    116 alias l='ls -CF'
    117 
    118 # Add an "alert" alias for long running commands.  Use like so:
    119 #   sleep 10; alert
    120 alias alert='notify-send --urgency=low -i "$( [ $? = 0 ] && echo terminal || echo error ; )" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
    121 
    122 # Alias definitions.
    123 # You may want to put all your additions into a separate file like
    124 # ~/.bash_aliases, instead of adding them here directly.
    125 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
    126 
    127 if [ -f ~/.bash_aliases ];
    128 then
    129     # shellcheck source=.bash_aliases
    130     source "$HOME/.bash_aliases"
    131 fi
    132 
    133 export PYTHONPATH="$HOME/.local/lib/python3.6:$PYTHONPATH"
    134 
    135 if [ -d "$HOME/gopath" ] ; then
    136         export GOPATH="$HOME/gopath"
    137         export PATH="$GOPATH/bin:$PATH"
    138 fi
    139 
    140 # enable programmable completion features (you don't need to enable
    141 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
    142 # sources /etc/bash.bashrc).
    143 if ! shopt -oq posix; then
    144   if [ -f /usr/share/bash-completion/bash_completion ]; then
    145     source /usr/share/bash-completion/bash_completion
    146   elif [ -f /etc/bash_completion ]; then
    147     source /etc/bash_completion
    148   fi
    149 fi
    150 if [ -r ~/.byobu/prompt ];
    151 then
    152     # shellcheck source=.byobu/prompt
    153     source "$HOME/.byobu/prompt"   #byobu-prompt#
    154 fi
    155 
    156 # For pipenv and virtualenvwrapper
    157 if [ -d "$HOME/.virtualenvs" ]; then
    158         export WORKON_HOME="$HOME/.virtualenvs"
    159 fi
    160 
    161 #export VIRTUALENVWRAPPER_PYTHON="/usr/bin/python3.6"
    162 if [ -f "$HOME/.local/binvirtualenvwrapper_lazy.sh" ]; then
    163     # shellcheck source=.local/bin/virtualenvwrapper_lazy.sh
    164     source "$HOME/.local/bin/virtualenvwrapper_lazy.sh"
    165 fi
    166 
    167 
    168 # <pipenv>
    169 _pipenv_completion() {
    170     local IFS=$'\t'
    171     COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
    172                    COMP_CWORD=$COMP_CWORD \
    173                    _PIPENV_COMPLETE=complete-bash "$1" ) )
    174     return 0
    175 }
    176 
    177 complete -F _pipenv_completion -o default pipenv
    178 # </pipenv>
    179 
    180 if [ -f "$HOME/.local/bin/find_pycompletion.sh" ]; then
    181     # shellcheck source=.local/bin/find_pycompletion.sh
    182     source "$(find_pycompletion.sh)"
    183 fi
    184 
    185 # https://unix.stackexchange.com/questions/72086/ctrl-s-hang-terminal-emulator
    186 stty -ixon
    187 
    188 printf "And now for something completely different:\n\n"
    189 fortune -c -a
    190 printf "\n"
    191 
    192 # <pip completion>
    193 _pip_completion()
    194 {
    195     COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
    196                    COMP_CWORD=$COMP_CWORD \
    197                    PIP_AUTO_COMPLETE=1 $1 ) )
    198 }
    199 complete -o default -F _pip_completion pip
    200 # </pip completion>