forked from mattmc3/zdotdir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zaliases
120 lines (103 loc) · 3.35 KB
/
.zaliases
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
#
# aliases - Zsh and bash aliases
#
# References
# - https://medium.com/@webprolific/getting-started-with-dotfiles-43c3602fd789#.vh7hhm6th
# - https://github.com/webpro/dotfiles/blob/master/system/.alias
# - https://github.com/mathiasbynens/dotfiles/blob/master/.aliases
# - https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/common-aliases/common-aliases.plugin.zsh
#
# single character shortcuts - be sparing!
alias _=sudo
alias g=git
# mask built-ins with better defaults
alias ping='ping -c 5'
alias grep="${aliases[grep]:-grep} --color=always --exclude-dir={$GREP_EXCLUDE}"
if (( $+commands[rg] )); then
alias rg="rg --color=always --smart-case --glob '!{$GREP_EXCLUDE}'"
alias ag='alias | rg'
alias frg='fzf-rg'
else
alias ag='alias | grep'
fi
# more ways to ls
if (( $+commands[eza] )); then
# z-shell/zsh-eza
# alias ls='eza -h --group-directories-first --color=always --color-scale all --git --icons --hyperlink --octal-permissions'
alias lS='la --sort=size'
alias lX='la --sort=extension'
alias lM='la --sort=modified'
alias lA='la --sort=accessed'
alias lC='la --sort=created'
alias llm='lM'
else
alias l=ls
alias ls='ls -h --group-directories-first --color=always'
alias ll='ls -l'
alias la='ls -lA'
alias lS='la --sort=size'
alias lX='la --sort=extension'
alias lM='la --sort=time'
alias lA='lM'
alias lC='lM'
alias llm='lM'
fi
alias lsa='ls -GA'
alias lD='ll -DA'
alias lc='ll -1'
alias lh='ls -ld .*'
alias ldot='lh'
# fix typos
alias get=git
alias quit='exit'
alias cd..='cd ..'
# date/time
alias timestamp="date '+%Y-%m-%d %H:%M:%S'"
alias datestamp="date '+%Y-%m-%d'"
alias isodate="date +%Y-%m-%dT%H:%M:%S%z"
alias utc="date -u +%Y-%m-%dT%H:%M:%SZ"
alias unixepoch="date +%s"
# disk usage
alias biggest='du -s ./* | sort -nr | awk '\''{print $2}'\'' | xargs du -sh'
alias dux='du -x --max-depth=1 | sort -n'
alias dud='du -d 1 -h'
alias duf='du -sh *'
# url encode/decode
alias urldecode='python3 -c "import sys, urllib.parse as ul; \
print(ul.unquote_plus(sys.argv[1]))"'
alias urlencode='python3 -c "import sys, urllib.parse as ul; \
print (ul.quote_plus(sys.argv[1]))"'
# ssh
alias sshrem='ssh-add -D'
alias sshall='fd $HOME/.ssh -type f -regex ".*/id_[^.]*$" | xargs ssh-add'
alias sshdir='cd $HOME/.ssh'
alias sshconfig='code $HOME/.ssh/config'
alias sshcreate='cd $HOME/.ssh && ssh-keygen -t ed25519 -C ${HOST%%.local}'
alias sshlist='ssh-add -l'
# zsh
alias zreload='exec zsh -l'
alias zrr='exec zsh -l'
alias arr='. $ZDOTDIR/conf.d/aliases.zsh'
alias zcompdir='zcompiledir'
alias zcheat='code $ZDOTDIR/.docs/zsh-cheatsheet.md'
alias zstring='code $ZDOTDIR/.docs/zsh-string.md'
alias zdotc='open $HOME/.config/zsh/zsh.code-workspace'
alias aliasedit='$EDITOR $ZDOTDIR/conf.d/aliases.zsh'
alias plugedit='$EDITOR $ZDOTDIR/.zplugins'
# directories
alias secrets="cd ${XDG_DATA_HOME:-~/.local/share}/secrets"
alias cdw='cd "${XDG_DATA_HOME}"'
# misc
alias please=sudo
alias zshrc='${EDITOR:-vim} "${ZDOTDIR:-$HOME}"/.zshrc'
alias zbench='for i in {1..10}; do /usr/bin/time zsh -lic exit; done'
alias cls="clear && printf '\e[3J'"
alias pacmanQR='pacman -Qqdt | pacman -Rsnu -'
# print things
alias ppath='echo ${PATH//:/\\n}'
alias fppath='echo ${FPATH//:/\\n}'
alias print-functions='print -l ${(k)functions[(I)[^_]*]} | sort'
# todo-txt
alias t="todo.sh"
alias todos="$VISUAL $HOME/Desktop/todo.txt"
# vim: ft=zsh sw=2 ts=2 et