~tardypad/dotfiles

ref: 859c03bb89aece1a6f0b3ae486191a91cdf244f1 dotfiles/files/configs/zsh/config.d/aliases.zsh -rw-r--r-- 2.9 KiB
859c03bb — Damien Tardy-Panis Add base shell script a month ago
                                                                                
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
# Prompt before overwrite/removal
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'

# colorize outputs
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias diff='diff --color=auto --palette="rs=0:hd=1:ad={color/add/fg}:de={color/delete/fg}:ln={color/base0B/fg}"'

# ls alias
alias lh='ls -lh'

# quick jump to often used folders
alias dk='cd "${XDG_DESKTOP_DIR:-$HOME/Desktop}"'
alias dw='cd "${XDG_DOWNLOAD_DIR:-$HOME/Downloads}"'
alias nt='cd "${XDG_NOTES_DIR:-$HOME/Notes}"'

# bluetooth connections
alias btc='bluetoothctl connect'
alias btd='bluetoothctl disconnect'

alias pj='goto-project repo'
alias PJ='goto-project main'
alias logs='goto-project logs'
alias docs='goto-project docs'

alias max='calculate maximum'
alias min='calculate minimum'
alias mean='calculate mean'
alias sum='calculate sum'

alias rn='read-news'
alias tt='time-tracker'
alias tts='time-tracker-sum'
alias dnd='do-not-disturb'
alias pmd='pomodoro'
alias lbl='line-by-line'

# smart cut on spaces
alias scut="tr -s ' ' '\t' | cut"

# DOS to Unix newlines
alias dos2unix="tr -d '\r'"

# Remove accents
alias unaccent="iconv -f UTF-8 -t ASCII//TRANSLIT"

# trim spaces
alias trim="sed -e 's/^ *//' -e 's/ *$//'"

# clean the tmux pane before running a command
alias clean='clear && tmux clear-history &&'

# display calendar for full year with week number and Monday as week start
alias calendar='cal --monday --week --year'

# disable status output on completion of some commands
alias mpc='mpc -q'

# reverse fzf when used in a terminal
# not included in FZF_DEFAULT_OPTS
# because we don't want this when used within vim
# (and there is no --noreverse option currently to overwrite it there)
alias fzf='fzf --reverse'

# most remote hosts don't have the tmux terminfo we use within tmux
alias ssh='TERM=xterm-256color ssh'

# switch to root
alias root='sudo -sE'

# reload shell
alias reload='source "${HOME}/.zshrc"'

# generate a password (mainly used to encrypt files to share)
alias passwdgen='echo $( < /dev/urandom tr -d -C "[:graph:]" | dd bs=1 count=30 2> /dev/null )'

# retrieve my public IP
alias myip='https api.ipify.org'

# simple linters
alias json-lint='jq'
alias xml-lint='xmllint --format -'

# allow usage of * in queries without need for escaping
alias mysql-env='noglob mysql-env'
alias redis-env='noglob redis-env'
alias influx-env='noglob influx-env'
alias qalc='noglob qalc'

# flush all .log files recursively in the current dir
alias flush-logs="find . -type f -name '*.log' -exec /bin/sh -c \"printf '' > '{}'\" \;"

# simpler ungronning
alias ungron="gron --ungron"

# Silver searcher default options
alias ag='ag --color-match="1;{color/search_match/fg}" --color-path="{color/base09/fg}" --color-line-number="{color/base0A/fg}" --case-sensitive --skip-vcs-ignores --follow'

# tests
alias test-micro='arecord -f cd -d 3 /tmp/test-micro.wav && aplay /tmp/test-micro.wav && rm -f /tmp/test-micro.wav'
alias test-webcam='mpv av://v4l2:/dev/video0'