-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
108 lines (96 loc) · 4.01 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
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
#!/usr/bin/env bash
# Don't use `set -e`
# === Docs / Help ===
alias devdocs="open https://devdocs.io/"
# === File management ===
alias is_symlink="test -L"
alias list="ls -halt"
alias folders_by_size="du -h -d 1 | sort -h"
alias folder_size="du -hs"
# tar flags:
# -c = created
# -z = compress
# -v = verbose
# -f = file / file as archive
# Can pass dirs and/or files
# Example: `tar -czvf output.tar.gz /dir/sub_dir file_a file_b`
alias tgz_create="tar -czvf"
alias tgz_list="tar -tzvf"
alias tgz_unpack="tar -xzvf"
alias exif="exiftool"
# -D = show with decimal
# -u = include unknown
# -U = include binary unknown
# Tip: exiftool supports JSON output! `-json`
alias exif_full="exiftool -D -u -U"
# Also works: magick identify -verbose ./file.jpg | grep Quality
alias get_jpeg_quality="exiftool -JPEGDigest -JPEGQualityEstimate"
alias get_file_mime="file --mime-type"
# === Data rendering / piping / inspecting / etc. ===
alias json_inspect="jless"
# === Process Management ===
alias check_last_command="[[ \$? -ne 0 ]] && echo 'Last command failed' || echo 'Last command succeeded'"
# == ASDF ==
alias asdf_update_listings="asdf plugin update"
# == Terminals, Shells ===
# = tmux =
alias tao="tmux_auto_open"
alias tmuxao="tmux_auto_open"
alias tmuxls="tmux ls"
alias tmuxss="tmux_session_select_and_attach"
alias tmuxsn="tmux_get_active_session_name"
alias tmuxws="tmux_window_select"
alias tmuxps="tmux_pane_select"
alias tmuxzp="tmux_pane_zoom_toggle"
alias tmuxz="tmux_pane_zoom_toggle"
alias tmuxconf-rl="tmux source-file ~/.tmux.conf"
alias tmuxhs="tmux split-window -h"
alias tmuxvs="tmux split-window -v"
alias tmuxkp="tmux kill-pane"
alias tmuxkw="tmux kill-window"
alias tmuxks="tmux kill-session"
alias tmuxds="tmux detach"
alias tmuxrn="tmux rename-session"
alias tmuxnw="tmux_new_window"
# == Security ===
alias rand_pass="openssl rand -base64 32"
# === Global stuff ===
alias gtask="task -t ~/Taskfile.global.yml"
alias npxg="npx_exec_global"
alias node_repl="node --experimental-repl-await"
# === git ===
alias git_search="git log -p -G"
alias git_find_deleted="git log --full-history -- "
alias gca="git commit --amend"
alias gcan="git commit --amend --no-edit"
alias gl="git log"
alias git_commit_skip_hooks="git commit --no-verify"
alias gdwd="git_do_while_dirty"
# Pass message / stash name as last arg
alias gss="git stash push --staged -m"
# Ignore large changes
alias gdsi="git diff --staged -- . ':(exclude)package-lock.json' ':(exclude)**/package-lock.json' ':(exclude)yarn.lock' ':(exclude)**/yarn.lock'"
# Pretty diff
alias gdsp="git diff --staged --word-diff=color --word-diff-regex=. --color-words"
# 3rd party aliases (provided by oh-my-zsh)
# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/git.plugin.zsh
# gd = git diff
# gds = git diff --staged
# ... many more
# === work ===
alias work_time="npx_exec_global --package jtz-time-tracker-utils jttu harvest rollup --target-user=just-me --target-week=this"
alias work_time_last="npx_exec_global --package jtz-time-tracker-utils jttu harvest rollup --target-user=just-me --target-week=last"
# VS Code: Wayland rendering issues workaround:
# Using an alias for this is slightly easier than hard-coding a solution, since
# configuring requires touching a mostly undocumented set of files (e.g. `~/.vscode/arvg.json`)
# WARNING: I'm still running into issues having VSCode rendering correctly with Wayland; these flags are working, but
# require running "Developer: Reload Window" after first launch for some reason
if [[ $IS_WAYLAND ]]; then
if (whereis code | grep -q '/snap/code'); then
# https://github.com/microsoft/vscode/issues/202072
alias code="echo 'Warning: Wayland flags cannot be set for snap-installed VS Code. Use .deb distribution instead.' && code"
else
# Note: 2>/dev/null used to suppress things like: `Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.`
alias code="code --ozone-platform=wayland --enable-features=UseOzonePlatform --ozone-platform-hint=wayland --enable-features=WaylandWindowDecorations 2>/dev/null"
fi
fi