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