-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaliases
49 lines (42 loc) · 1.98 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
#!/usr/bin/env zsh
################################################################################
# Information
################################################################################
# Maintained by William W. Marx (m94@marx.sh)
# 🄯 Copyleft 2022, All Wrongs Reserved
# https://github.com/williamwmarx/shell
# ---------------------------------- System -----------------------------------
# Enable `open`, `pbcopy`, and `pbpaste` commands to work across macOS, Linux, and WSL
if [ ! $(uname -s) = "Darwin" ]; then
alias pbcopy="xsel --clipboard --input"
alias pbpaste="xsel --clipboard --output"
if grep -q Microsoft /proc/version; then # WSL
alias open="explorer.exe";
else # Non-WSL Linux
alias open="xdg-open";
fi
fi
# If `exa` is instaled, use it instead of `ls` and `tree`
if [ $(which exa &>/dev/null && echo "$?") -eq 0 ]; then
alias ls="exa"
alias tree="exa -T"
fi
alias o="open ." # Open current directory in system file manager
alias pfkill="ps aux | fzf | awk '{print $2}'" # Kind of like pkill, but using fzf
# --------------------------------- Navigation --------------------------------
alias ds="cd ~/Desktop"
alias dc="cd ~/Documents"
alias dl="cd ~/Downloads"
# ------------------------------------ tmux -----------------------------------
alias tmcp="tmux save-buffer - | pbcopy" # Copy tmux buffer into system clipboard
# ------------------------------------ Misc -----------------------------------
alias expandurl="curl -sIL $1 | rg -Po \"(?<=location: ).+\" | tail -1"
# ------------------------------- macOS Specific ------------------------------
if [ $(uname -s) = "Darwin" ]; then
if [ $(uname -m) = "arm64" ]; then
alias d64-run="arch -x86_64 docker run --platform linux/amd64" # Docker x86_64 images on M1
fi
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
alias afk="pmset displaysleepnow" # Lock display
fi