Blob


1 # ~/.bashrc: executed by bash(1) for non-login shells.
2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3 # for examples
5 # If not running interactively, don't do anything
6 case $- in
7 *i*) ;;
8 *) return;;
9 esac
11 # don't put duplicate lines or lines starting with space in the history.
12 # See bash(1) for more options
13 HISTCONTROL=ignoreboth
15 # append to the history file, don't overwrite it
16 shopt -s histappend
18 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
19 HISTSIZE=3000
20 HISTFILESIZE=8000
22 # check the window size after each command and, if necessary,
23 # update the values of LINES and COLUMNS.
24 shopt -s checkwinsize
26 # If set, the pattern "**" used in a pathname expansion context will
27 # match all files and zero or more directories and subdirectories.
28 #shopt -s globstar
30 case "$TERM" in
31 xterm)
32 # Try to ensure we have 256 colors
33 export TERM="xterm-256color"
34 ;;
35 esac
37 # Set visual bell
38 set bell-style visible
40 # Set selection for pass password-manager
41 PASSWORD_STORE_X_SELECTION=primary
43 ##############################################################################
44 # Color
45 ##############################################################################
47 # byobu's bashrc -- colorize the prompt
48 # Copyright (C) 2013 Dustin Kirkland
49 #
50 # Authors: Dustin Kirkland <kirkland@byobu.co>
51 #
52 # This program is free software: you can redistribute it and/or modify
53 # it under the terms of the GNU General Public License as published by
54 # the Free Software Foundation, version 3 of the License.
55 # Ensure that we're in bash, in a byobu environment
56 # Use Ubuntu colors (grey / aubergine / orange)
58 if [ -z "$SSH_CLIENT" ]; then
59 PS1_TRENNER="!"
60 else
61 PS1_TRENNER="@"
62 fi
63 txtrst='\e[0m' # Text Reset
65 if [ `id -u` -eq 0 ]; then
66 PS1_USER="\[\e[0;101m\]\u\[${txtrst}\]"
67 else
68 PS1_USER="\[\e[38;5;245m\]\u\[${txtrst}\]"
70 fi
72 PS1="\[\e[38;5;202m\]\[\e[38;5;5m\]\h\[${txtrst}\]${PS1_TRENNER}"
73 PS1+="${PS1_USER}"
74 PS1+="${PS1_VCS}"
75 PS1+=" \[\e[38;5;172m\]\w\[${txtrst}\] [\j] \$ "
77 export GREP_COLORS="ms=01;38;5;202:mc=01;31:sl=:cx=:fn=01;38;5;132:ln=32:bn=32:se=00;38;5;242"
79 # UBUNTU COLORS
80 #export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode – red
81 #export LESS_TERMCAP_md=$(printf '\e[01;38;5;180m') # enter double-bright mode – bold light orange
82 #export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us)
83 #export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode
84 #export LESS_TERMCAP_so=$(printf '\e[03;38;5;202m') # enter standout mode – orange background highlight (or italics)
85 #export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode
86 #export LESS_TERMCAP_us=$(printf '\e[04;38;5;139m') # enter underline mode – underline aubergine
88 # Less Colors for Man Pages
89 export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
90 export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
91 export LESS_TERMCAP_me=$'\E[0m' # end mode
92 export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
93 export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
94 export LESS_TERMCAP_ue=$'\E[0m' # end underline
95 export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
97 # If this is an xterm set the title to user@host:dir
98 case "$TERM" in
99 xterm*|rxvt*)
100 PS1="\[\e]0;\h!\u: \w\a\]$PS1"
101 ;;
102 *)
103 ;;
104 esac
106 # enable color support of ls and also add handy aliases
107 if [ -x /usr/bin/dircolors ]; then
108 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
109 alias grep='grep --color=auto'
110 alias fgrep='fgrep --color=auto'
111 alias egrep='egrep --color=auto'
112 fi
114 ##############################################################################
115 # Exports
116 ##############################################################################
118 export EDITOR=vim
119 export PATH=$HOME/Documents/bin:$PATH
121 export XDG_CONFIG_HOME="$HOME/.config"
122 export XDG_DATA_HOME="$HOME/.local/share"
123 export XDG_CACHE_HOME="$HOME/.cache"
125 ##############################################################################
126 # Aliases
127 ##############################################################################
129 if [ -f ~/.aliasrc ]; then
130 . ~/.aliasrc
131 fi
133 if [ -f ~/.aliasrc.private ]; then
134 . ~/.aliasrc.private
135 fi
137 if [ -f ~/.aliasrc.work ]; then
138 . ~/.aliasrc.work
139 fi
141 ##############################################################################
143 # enable programmable completion features (you don't need to enable
144 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
145 # sources /etc/bash.bashrc).
146 if ! shopt -oq posix; then
147 if [ -f /usr/share/bash-completion/bash_completion ]; then
148 . /usr/share/bash-completion/bash_completion
149 elif [ -f /etc/bash_completion ]; then
150 . /etc/bash_completion
151 fi
152 fi
154 # Git completion
155 if [ -f /usr/share/git/completion/git-prompt.sh ]; then
156 source /usr/share/git/completion/git-prompt.sh
157 fi
159 # Compression
160 complete -f -o default -X '*.+(zip|ZIP)' zip
161 complete -f -o default -X '!*.+(zip|ZIP)' unzip
162 complete -f -o default -X '*.+(z|Z)' compress
163 complete -f -o default -X '!*.+(z|Z)' uncompress
164 complete -f -o default -X '*.+(gz|GZ)' gzip
165 complete -f -o default -X '!*.+(gz|GZ)' gunzip
166 complete -f -o default -X '*.+(bz2|BZ2)' bzip2
167 complete -f -o default -X '!*.+(bz2|BZ2)' bunzip2
168 complete -f -o default -X '!*.+(zip|ZIP|z|Z|gz|GZ|bz2|BZ2)' extract
170 _completemarks() {
171 local curw=${COMP_WORDS[COMP_CWORD]}
172 local wordlist=$(find $MARKPATH -type l -printf "%f\n")
173 COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
174 return 0
177 complete -F _completemarks jump unmark j
179 [ -f /usr/share/git/completion/git-completion.bash ] && source /usr/share/git/completion/git-completion.bash
181 ##############################################################################
182 # Functions
183 ##############################################################################
185 source $HOME/.functions
187 ##############################################################################
188 # SSH/GPG Agent stuff
189 ##############################################################################
191 # Suck in GPG agent vars
192 if [ -e "$HOME"/.gpgssh.env ]; then
193 source ~/.gpgssh.env
194 fi
196 alias sshclose='pkill -u $USER ssh-agent && echo "SSH-Agents killed."; rm -f "$HOME"/.ssh/`hostname`.agent'
198 if [ -e "$HOME"/.ssh/`hostname`.agent ]; then
199 source "$HOME"/.ssh/`hostname`.agent ;
200 fi