~whynothugo/dotfiles

ref: a0f5cd74bd50278d22cd29f1a1f23ed8a9714e1d dotfiles/home/.config/sh/aliases.sh -rw-r--r-- 2.2 KiB
a0f5cd74 — Hugo Osvaldo Barrera sh: Tidy up comment 3 months ago
                                                                                
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
#!/bin/sh
#
# Shell aliases
#
# A kitchen sink of aliases. These are all used interactively and not for
# scripts.

# Directory listing aliases.
alias l="lsd -A"
alias ll="lsd -lA"
alias tree='lsd --tree'

# Git Directory: Change directory into the current repo's root.
# Use `popd` to jump back.
alias gitd='pushd $(git rev-parse --show-toplevel)'

# Show system info.
alias 🐼=neofetch

# Allows editing a root-owned file without running neovim as root.
# It makes a temporary copy of the files and runs $EDITOR as the current user.
# See `man sudoedit` for details.
alias se="sudoedit"

alias grep="grep --color=auto --exclude-dir=.git"
alias ssh='TERM=xterm-256color ssh'
alias tmux='/usr/bin/tmux -f ~/.config/tmux/tmux.conf'
alias calc="bc -l"

alias markers="ag 'TODO:|FIXME:|XXX:' "

# Git
alias f='git fetch'
alias s='git status'
alias p='git push -u origin HEAD'
alias p1='git push origin HEAD~:refs/heads/$(git branch --show-current)'
alias pt='git push -u origin --tags'
alias u='git fetch && git rebase --autostash origin/$(git branch --show-current)'
# See https://github.com/dandavison/delta/issues/703
alias sts="git -c delta.side-by-side=true "


alias av="aws-vault exec"

# Shortcut for printing sway logs. Usually used with --this-boot or --follow.
alias swaylogs="journalctl --user --identifier sway"

# === Nix
# Nix uses `bash` by default. This is the only way to run `zsh` instead.
# It still relies on the bash wrapper, which is annoying.
alias ns="nix-shell --command zsh "

# === macOS specific
# Brew needs this to work on Big Sur:
alias brew="arch -x86_64 /usr/local/bin/brew "

# === NVM
# Things like NVM have a werid design where they're designed to run every time
# you spawn a new shell, and continuously run different hooks. This is terrible
# design and terrible for performance wise, and also messes up how the shell
# NORMALLY works.
#
# This function is a workaround so that `nvm` can be run explicitly when
# needed, but doesn't bother when not explicitly invoken. Like any other tool.

nvm_on() {
  export NVM_DIR="$HOME/.cache/nvm"
  # shellcheck disable=1091 # Shellcheck runs in a container, so cannot follow absolute paths
  . /usr/share/nvm/init-nvm.sh
  nvm use
}