guix: disable tlp’s usb-autosuspend completely for now
[~bandali/configs] / .bashrc
... / ...
CommitLineData
1# Bash initialization for interactive non-login shells and
2# for remote shells (info "(bash) Bash Startup Files").
3
4# Export 'SHELL' to child processes. Programs such as 'screen'
5# honor it and otherwise use /bin/sh.
6export SHELL
7
8if [[ $- != *i* ]]
9then
10 # We are being invoked from a non-interactive shell. If this
11 # is an SSH session (as in "ssh host command"), source
12 # /etc/profile so we get PATH and other essential variables.
13 [[ -n "$SSH_CLIENT" ]] && source /etc/profile
14
15 # Don't do anything else.
16 return
17fi
18
19# Source the system-wide file.
20source /etc/bashrc
21
22# from https://unix.stackexchange.com/a/55935
23a_prompt() {
24 cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD)
25 printf $cwd
26}
27# Adjust the prompt depending on whether we're in 'guix environment'.
28if [ -n "$GUIX_ENVIRONMENT" ]
29then
30 PS1="\u@\h [env] \$(a_prompt)> "
31else
32 PS1="\u@\h \$(a_prompt)> "
33fi
34
35# i-beam cursor
36# echo -e "\033[5 q" # blinking
37# echo -e "\033[6 q" # non-blinking
38
39# various bash tweaks
40shopt -s histappend
41shopt -s cmdhist
42HISTSIZE=
43HISTFILESIZE=
44HISTCONTROL=ignoreboth
45HISTIGNORE='ls:l:s:g:[bf]g:history'
46HISTTIMEFORMAT='%F %T '
47stty stop ""
48
49# aliases
50alias ls='ls -p --color=auto'
51alias l='ls -lh' # long format and human-readable sizes
52alias ll='l -A' # long format, all files
53alias grep='grep --color=auto'
54alias mpv="mpv --ytdl-format mp4"
55alias mv="mv -iv"
56alias cp="cp -iv"
57alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
58alias getmail='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
59alias m="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub"
60alias best="youtube-dl -f best"
61alias e="$EDITOR"
62alias se="SUDO_EDITOR=\"emacsclient\" sudo -e"
63
64aur() {
65 cd ~/usr/builds
66 [ -d ${1} ] || git clone https://aur.archlinux.org/${1}.git
67 cd ${1}
68}
69
70if [ -z "$IS_GUIX_SYSTEM" ]; then
71 if ! pgrep -u "$USER" ssh-agent > /dev/null; then
72 ssh-agent > ~/.ssh-agent-thing
73 fi
74 if [[ ! "$SSH_AUTH_SOCK" ]]; then
75 eval "$(<~/.ssh-agent-thing)"
76 fi
77fi