-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_commonrc
135 lines (110 loc) · 3.07 KB
/
dot_commonrc
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# run every time you launch a non-login shell
# here: aliases, functions
# individual rc: custom prompts, history customizations
# echo commonrc
DIR=./Downloads; [ -d $DIR ] && cd $DIR
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time background_jobs direnv asdf virtualenv anaconda pyenv goenv nodenv nvm nodeenv rbenv rvm fvm luaenv jenv plenv phpenv scalaenv haskell_stack kubecontext terraform aws_eb_env azure gcloud google_app_cred context nordvpn ranger nnn xplr vim_shell midnight_commander nix_shell todo timewarrior taskwarrior time newline)
for FILE in ~/.fzf.bash ~/.bash_aliases ~/.bash_docker ~/.zsh_aliases ~/.workrc
do
[ -f $FILE ] && . $FILE
done
# Override zsh's common-alias
alias l='ls -alhF'
# alias la='ls -A'
# alias l='ls -CF'
# alias ll='ls -alF'
# alias a="autorandr --change"
alias c="chezmoi"
alias b="bat"
alias f="find -type d,f -name"
alias res="pkill --oldest chrome; sleep 1; sudo reboot"
alias o='xdg-open'
alias ok='fuck'
alias v="nvim"
alias co="~/zack_setup_env/config_opener.sh"
# Ubuntu
alias sapt="sudo apt"
alias saptgi="sudo apt-get install "
# Git
alias acp="gaa; gc; gp"
# Add an "alert" alias for long running commands. Use like so: sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# HSTR
alias hh=hstr # hh to be alias for hstr
function frm {
now=$(date "+%F-%T-%Z")
for file in "$@"
do
new_name="${file}_${now}"
mv -i -- "$file" "$new_name"
nohup rm -rf -- "$new_name" > "/tmp/$new_name.log" 2>&1 &
done
}
function s {
pdfgrep -i -H -n -r $1
}
function q {
gdate +%r -d "$1:$2:$3 UTC"
gdate -d "$1:$2 UTC"
}
function cd() {
builtin cd "$@"
if [[ -z "$VIRTUAL_ENV" ]] ; then
## If env folder is found then activate the vitualenv
if [[ -d ./.venv ]] ; then
source ./.venv/bin/activate
fi
else
## check the current folder belong to earlier VIRTUAL_ENV folder
# if yes then do nothing
# else deactivate
parentdir="$(dirname "$VIRTUAL_ENV")"
if [[ "$PWD"/ != "$parentdir"/* ]] ; then
deactivate
fi
fi
}
function bm {
ENTRY=$(grep "$1" $HOME/.config/gtk-3.0/bookmarks)
DIR=$(echo "$ENTRY" | sed 's|file://||g' | cut -d' ' -f1)
cd $DIR
}
# function b {
# sudo ddcutil --display $1 setvcp $(( 10 + $2 )) $3
# }
# function b {
# m --brightness $1 --contrast $1
# }
function x {
xrandr --output DP-2 --brightness $1
}
function x2 {
ddcutil --display 2 setvcp 10 $1
ddcutil --display 2 setvcp 12 $1
}
function mb {
base_cmd="m --low_blue_light"
option="on"
if [[ $(m -f low_blue_light | awk '{print $NF}') = "on" ]]; then
option="off"
fi
eval "$base_cmd $option"
}
function k {
mkdir tex && cd tex && v "$1.tex"
}
case "$(uname -s)" in
Linux)
eval $(thefuck --alias)
;;
Darwin)
# mac
eval "$(pyenv init -)"
eval $(thefuck --alias)
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
;;
*)
;;
esac
source ~/.config/broot/launcher/bash/br