aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc
blob: a913b2de70314b401a5cdb3130f59aab8a96faf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Don't do anything if not running interactively.
[ -z "$PS1" ] && return

# Keep plenty of history.
unset HISTFILESIZE
HISTSIZE=1000000

# Ignore duplicate commands and whitespace in history.
HISTCONTROL=ignoreboth

# Keep the times of the commands in history.
HISTTIMEFORMAT='%F %T  '

# Ignore certain commands for the history.
HISTIGNORE='ls:ls -l:ls -la:fg:bg:jobs:history'

# Add all commands to the history immediately.
PROMPT_COMMAND='history -a;history -n'

# Don't check for mail all the time, it's irritating.
unset MAILCHECK

# Autocorrect fudged paths in cd calls.
shopt -s cdspell

# Update columns and rows if window size changes.
shopt -s checkwinsize

# Put multi-line commands onto one line of history.
shopt -s cmdhist

# Append rather than overwrite Bash history.
shopt -s histappend

# Simple prompt.
PS1='\u@\h:\w\$ '
PS2='...'

# Use colors for ls and grep, if available.
if [ -x /usr/bin/dircolors ]; then
    eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
fi

# Use completion, if available.
if [ -e /etc/bash_completion ]; then
    . /etc/bash_completion
fi

# SSH agent setup, if available.
if [ -e ~/.ssh/agent ]; then
    . ~/.ssh/agent
fi

# Turn off annoying and useless flow control keys.
stty -ixon

# Never beep at me.
setterm -bfreq 0

# Use vi as my text editor, if available.
hash vi &>/dev/null
if [ $? -eq 0 ]; then
    export EDITOR=vi
fi

# Terminal-specific settings.
case "$TERM" in

    # Set xterm title, use 256 colors.
    xterm*)
        PS1="\[\e]0;\h\a\]"${PS1}
        TERM=xterm-256color
        ;;

    # Set screen window title.
    screen*)
        PROMPT_COMMAND="printf '\033k$(hostname -s)\033\\';"${PROMPT_COMMAND}
        ;;
esac