Commit | Line | Data |
---|---|---|
d99f86cd AB |
1 | # If not running interactively, don't do anything else |
2 | [[ $- != *i* ]] && return | |
3 | ||
840b56ca AB |
4 | [[ $TERM = "eterm-color" || $TERM = "screen" ]] && source ~/.bash_profile |
5 | ||
acb525a9 AB |
6 | # from https://unix.stackexchange.com/a/55935 |
7 | a_prompt() { | |
8 | cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD) | |
9 | printf $cwd | |
10 | } | |
11 | PS1="\u@\h \$(a_prompt)> " | |
12 | ||
d99f86cd AB |
13 | # i-beam cursor |
14 | # echo -e "\033[5 q" # blinking | |
15 | echo -e "\033[6 q" # non-blinking | |
16 | ||
58a81de3 AB |
17 | # various bash tweaks |
18 | shopt -s histappend | |
19 | shopt -s cmdhist | |
20 | HISTSIZE= | |
21 | HISTFILESIZE= | |
22 | HISTCONTROL=ignoreboth | |
d99f86cd | 23 | HISTIGNORE='ls:l:s:g:[bf]g:history' |
58a81de3 AB |
24 | HISTTIMEFORMAT='%F %T ' |
25 | stty stop "" | |
6b8582fa | 26 | |
dc9a8087 | 27 | # aliases |
6b8582fa | 28 | alias ls='ls --color=auto' |
d99f86cd AB |
29 | alias l='ls -lh' # long format and human-readable sizes |
30 | alias ll='l -A' # long format, all files | |
31 | alias g='git' | |
32 | include /usr/share/bash-completion/completions/git && __git_complete g _git | |
dc9a8087 AB |
33 | alias mpv="mpv --ytdl-format mp4" |
34 | alias mv="mv -iv" | |
35 | alias cp="cp -iv" | |
36 | alias scl=systemctl | |
37 | alias jcl=journalctl | |
c036d6d7 | 38 | alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc' |
249a5298 AB |
39 | alias getmail='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc' |
40 | alias mb="mbsync csclub; mbsync uwaterloo; mbsync amin" | |
41 | alias gm="getmail" | |
42 | alias m="mb; gm" | |
dc9a8087 | 43 | alias best="youtube-dl -f best" |
d355f997 AB |
44 | alias e="$EDITOR" |
45 | alias se="SUDO_EDITOR=\"emacsclient\" sudo -e" | |
dc9a8087 AB |
46 | |
47 | aur() { | |
48 | cd ~/usr/builds | |
d55c009f | 49 | [ -d ${1} ] || git clone https://aur.archlinux.org/${1}.git |
dc9a8087 AB |
50 | cd ${1} |
51 | } | |
52 | ||
d99f86cd AB |
53 | # fzf |
54 | include /usr/share/fzf/key-bindings.bash | |
55 | include /usr/share/fzf/completion.bash | |
58a81de3 | 56 | |
6e39e3a2 AB |
57 | if ! pgrep -u "$USER" ssh-agent > /dev/null; then |
58 | ssh-agent > ~/.ssh-agent-thing | |
59 | fi | |
60 | if [[ ! "$SSH_AUTH_SOCK" ]]; then | |
61 | eval "$(<~/.ssh-agent-thing)" | |
62 | fi |