-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.aliases
69 lines (51 loc) · 2.21 KB
/
.aliases
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
alias alert="echo -e '\a'"
alias dt="/bin/date +%Y-%m-%d-%H%M%S"
alias d="/bin/date +%F"
alias yyyy-mm-dd='/bin/date -Idate'
alias yyyy-mm-dd-hh-mm-ss='/bin/date -Iseconds'
[[ -x "/usr/bin/htop" ]] && alias top="/usr/bin/htop"
alias sudo='/usr/bin/sudo --preserve-env'
alias override='/usr/bin/sudo --preserve-env $SHELL -c "$(fc -ln -1)"'
alias lockscreen='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'
alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'
alias vi="vim"
alias v="vim"
alias rg="rg --no-ignore-parent --smart-case"
alias rsync="/usr/bin/rsync -av --progress"
function timestamp() {
local original_tz=$TZ
unset TZ
if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == *"bsd"* ]]; then
echo "$(/bin/date -r $1 -u '+%FT%T%z (%Z)')"
else
echo "$(/usr/bin/date -d @$1 -u '+%FT%T%z (%Z)')"\
"/ $(/usr/bin/date -d @$1 '+%FT%T%z (%Z)')"
fi
export TZ=original_tz
}
# set colors for /bin/ls on GNU systems
if [[ -x "/usr/bin/dircolors" ]] && [[ -r "$HOME/.dir_colors" ]]; then;
eval $(/usr/bin/dircolors "$HOME/.dir_colors")
fi
# set colors for /bin/ls on macOS systems
if [[ "$OSTYPE" == *'darwin'* ]]; then
export CLICOLOR=1
export LSCOLORS='Gxfxcxdxbxegedabagacad'
fi
alias grep="/usr/bin/grep --color=auto"
alias fgrep="/usr/bin/fgrep --color=auto"
alias egrep="/usr/bin/egrep --color=auto"
alias ls="/bin/ls --color=auto"
[[ "$OSTYPE" == "linux-gnu" ]] && alias l="ls -alFht"
[[ "$OSTYPE" == "darwin"* ]] && alias l="ls -alFhtO";
# find a file with a pattern in name:
function ff() { /usr/bin/find . -type f -iname '*'$*'*' -ls ; }
# find a directory with a pattern in name:
function fd() { /usr/bin/find . -type d -iname '*'$*'*' -ls ; }
# find a file with pattern $1 in name and Execute $2 on it:
function fe() { /usr/bin/find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; ; }
noglob function calc() { /usr/bin/bc -l <<< "scale=4; $*;" } # quick bc frontend with 4 decimal precision
# a briefer, tidier, less safe version of iTerm2's it2setkeylabel
# see https://www.iterm2.com/documentation-escape-codes.html
function set_status_label() { echo -n "\033]1337;SetKeyLabel=status=$@\a" }
# vim: ft=zsh