-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc
71 lines (62 loc) · 2.46 KB
/
bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Start the init process for dotfiles on the first login
# See README for more details
[ -f ~/.init ] && ~/dotfiles/.setup/init.sh auto
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
[ -f ~/dotfiles/bash/colors ] && source ~/dotfiles/bash/colors
[ -f /usr/share/bash-completion/bash_completion ] && source /usr/share/bash-completion/bash_completion
export TZ="America/Toronto"
export BROWSER="firefox"
export EDITOR="subl"
PATH="$HOME/dotfiles/bash/scripts:$PATH"
PATH="$HOME/bin:$PATH"
PATH="$HOME/.local/bin:$PATH"
PATH="/usr/local/bin:$PATH"
export PATH
# use qt5ct to configure QT themes in i3wm
export QT_QPA_PLATFORMTHEME=qt5ct
export LS_COLORS="$LS_COLORS:ow=1;7;34:st=30;44:su=30;41"
export MANPAGER="less -i"
export PASSWORD_STORE_CLIP_TIME=125
export FZF_DEFAULT_OPTS="--inline-info --header=──────────────────────────────── --color=16,info:0,header:236,prompt:236,hl:9,fg+:9 --reverse --height=10 --history-size=100000"
# History settings
export HISTSIZE=-1; export HISTFILESIZE=-1; export HISTCONTROL="ignoredups"; export LESSHISTFILE="/dev/null"
alias venv.activate="source .venv/bin/activate"
alias ls="ls --group-directories-first --file-type -h --color=always"
alias arandr="arandr && ~/.fehbg"
alias cls="clear"
alias df="df -x tmpfs -x devtmpfs -x vfat -h"
# git aliases
alias gs="git status"; alias ga="git add"; alias gl="git log"; alias gc="git commit"; alias gd="git diff"
# Override `git log`
git() {
if [[ "$1" = "log" ]]; then
command git log --pretty=format:"%C(yellow)%h %Cblue[%cn] %Cgreen%ad%C(auto)%d%n%n%Creset %s%n" --decorate --date=relative "${@:2}"
else
command git "$@"
fi
}
# Override `tmux ls` and use fzf to provide a menu to select a session
tmux() {
if [[ "$1" = "ls" ]]; then
session=$(tmux list-sessions -F "#{session_name}" | fzf --exit-0)\
&& tmux attach -t "$session"
else
command tmux "$@"
fi
}
# Calculator
# = 1+1
# calc 1+1
= () { printf "%'.f\n" $(echo $1 | bc); }; alias calc==
# Prompt
set_ps1() {
if test -z "$VIRTUAL_ENV"; then
VENV=""
else
VENV="${GREEN}(`basename \"$VIRTUAL_ENV\"`)${COLOR_NONE} "
fi
PS1="\[$BGreen\]\u@\H \[$BPurple\]\w\[$IGreen\]$(__git_ps1 " (%s\[$IGreen\])") \[$IPurple\]$VENV\n\[$BPurple\]> \[$Color_Off\]"
}
GIT_PS1_STATESEPARATOR="\[$Purple\] "; GIT_PS1_SHOWSTASHSTATE=1; GIT_PS1_SHOWDIRTYSTATE=1; GIT_PS1_SHOWUNTRACKEDFILES=1
PROMPT_COMMAND=set_ps1
. "$HOME/.cargo/env"