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