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