-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzsh_aliases
More file actions
101 lines (88 loc) · 2.06 KB
/
zsh_aliases
File metadata and controls
101 lines (88 loc) · 2.06 KB
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
# -*- sh -*-
##
# variable
_OPTIONS='--color=auto'
##
# alias
alias b='cd ..'
alias calc='autoload -U zcalc && zcalc'
alias e=$EDITOR
alias l='ls $_OPTIONS'
alias s='su'
alias x='exit'
alias zcp='zmv -wC'
alias zln='zmv -wL'
alias zmv='zmv -wM'
##
# using rsync
alias cp='rsync -pP'
alias scp='rsync -pP'
##
# default options
alias ebuild='FEATURES=-mini-manifest ebuild'
alias grep='grep $_OPTIONS'
alias ls='ls $_OPTIONS'
alias tmux='tmux -2'
##
# prompt for overwrite
#alias cp='cp -i'
alias ln='ln -i'
alias mv='mv -i'
##
# global alias
alias -g G='| grep'
alias -g H='| head'
alias -g L='| less'
alias -g T='| tail'
##
# dirs
hash -d t='~/tmp'
hash -d D='/media/Dane'
hash -d cdrom='/media/cdrom'
hash -d torrents='/media/Dane/Torrents'
##
# mac aliases
if [[ $(uname) == 'Darwin' ]]; then
alias mtr='sudo /usr/local/sbin/mtr'
fi
##
# use gopass if available
if command -v gopass 2>&1 >/dev/null; then
alias pass='gopass'
fi
##
# use bat/batcat if available
if command -v bat 2>&1 >/dev/null; then
alias catcat='/bin/cat'
alias cat='bat'
elif command -v batcat 2>&1 >/dev/null; then
alias catcat='/bin/cat'
alias cat='batcat'
fi
##
# list snapshots
if command -v autorestic 2>&1 >/dev/null; then
alias arestic='autorestic exec -av -- '
fi
##
# Docker-based commands
if command -v podman 2>&1 >/dev/null && ! command -v docker 2>&1 >/dev/null; then
alias docker='podman'
fi
if ! command -v hugo 2>&1 >/dev/null; then
hugo() {
set -x
# docker run --rm -u $(id -u):$(id -g) -v "${PWD}/src:/src" -it -p 1313:1313 klakegg/hugo:alpine $@
# user switch not needed in podman, permissions are correct without it
# setting it breaks lock acquire
podman run --rm -v "${PWD}/src:/src" -it -p 1313:1313 klakegg/hugo:alpine $@
set +x
}
fi
if ! command -v helmfile 2>&1 >/dev/null; then
helmfile() {
set -x
docker run --rm -v "${HOME}/.kube:/helm/.kube" -v "${HOME}/.config/helm:/helm/.config/helm" -v "${PWD}:/wd" --workdir /wd ghcr.io/helmfile/helmfile:v0.151.0 helmfile $@
set +x
}
fi