home · contact · privacy
a5a9ee27df2fb1da5c3e0652d807d697a9106848
[config] / dotfiles_minimal / shinit
1 # Settings for interactive shells.
2
3 # Fancy colors for ls.
4 alias ls="ls --color=auto"
5
6 # Use vim as default editor for anything.
7 export VISUAL=vim
8 export EDITOR=$VISUAL
9
10 # Colored prompt with username, hostname, date/time, directory.
11 colornumber=7 # Default to white if no color set via colornumber dotfile.
12 colornumber_file=~/.shinit_color
13 if [ -f $colornumber_file ]; then
14     colornumber=`cat $colornumber_file` 
15 fi
16 tput_color="$(tput setaf $colornumber)$(tput bold)"
17 tput_reset="$(tput sgr0)"
18 # Bash confuses the line length when not told to not count escape sequences.
19 which_shell=`lsof -ap $$ -d txt | awk 'NR>1 {print $NF}'`
20 if [ "${which_shell#*'bash'}" != "$which_shell" ]; then
21     tput_color="\[$tput_color\]"
22     tput_reset="\[$tput_reset\]"
23 fi
24 PS1="${tput_color}["\$\(date\ +%Y-%m-%d/%H:%M:%S/%Z\)" $USER@$(hostname):"\$\(pwd\)"]$ $tput_reset"
25 PS2="${tput_color}> $tput_reset"
26 PS3="${tput_color}select: $tput_reset"
27 PS4="${tput_color}+ $tput_reset"
28
29 # Add local additions.
30 local_shinit_file=~/.shinit_add
31 if [ -f $local_shinit_file ]; then 
32     . $local_shinit_file 
33 fi