aboutsummaryrefslogtreecommitdiff
path: root/.config/shell/aliasrc
blob: 0516814980ebc44a360976deaf5e12caa682258e (plain)
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
#!/bin/sh

# Use neovim for vim if present.
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"

[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC"

# doas not required for some system commands
for command in mount umount rc-service rc-update emerge emaint updatedb su shutdown poweroff reboot ; do
  alias $command="doas $command"
done; unset command

se() {
  choice="$(fd . --base-directory=$HOME/.local/bin -t f --min-depth=1 | fzf)"
  [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
}

# Verbosity and settings that you pretty much just always are going to want.
alias \
  cp="cp -iv" \
  mv="mv -iv" \
  rm="rm -vI" \
  bc="bc -ql" \
  rsync="rsync -vrPlu" \
  mkd="mkdir -pv" \
  yt="yt-dlp --embed-metadata -i" \
  yta="yt -x -f bestaudio/best" \
  ytt="yt --skip-download --write-thumbnail" \
  ffmpeg="ffmpeg -hide_banner"

# Colorize commands when possible.
alias \
  ll="eza -lh --group-directories-first --color=auto --color-scale=all --color-scale-mode=fixed --icons --no-quotes --smart-group -s size --total-size --no-user --no-permissions" \
  ls="eza --group-directories-first --color=auto --icons --no-quotes -s name" \
  lsf="eza -f --group-directories-first --color=auto --icons --no-quotes -s name" \
  lsd="eza -D --group-directories-first --color=auto --icons --no-quotes -s name" \
  lst="eza -lh --group-directories-first --color=auto --color-scale --icons --no-quotes --smart-group -s time --total-size --no-user --no-permissions" \
  cat="bat -P" \
  ccat="highlight --out-format=ansi" \
  ip="ip -color=auto"

# These common commands are just too long! Abbreviate them.
alias \
  cl="clear" \
  ka="killall" \
  trem="transmission-remote" \
  YT="youtube-viewer" \
  sdn="shutdown -h now" \
  e="emerge" \
  v="$EDITOR" \
  p="paru" \
  z="zathura" \
  lg="lazygit" \
  sx="swayimg" \
  md="monerod --prune-blockchain --fast-block-sync 1 --data-dir /mnt/ssd/monero/bitmonero" \
  fetch="fastfetch --logo-color-2 default" \
  de="doasedit" \
  emg="emerge -avuDN @world"

# Git related
alias \
  g="git" \
  gs="git status --short" \
  gd="git diff" \
  ga="git add" \
  gc="git commit" \
  gp="git push" \
  gu="git pull" \
  gl="git log" \
  gb="git branch" \
  gi="git init" \
  gcl="git clone"

alias \
  magit="nvim -c MagitOnly" \
  ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"