summaryrefslogtreecommitdiff
path: root/bash/.bash_aliases
blob: 3693bf5c428df98342348f27d226433da3688310 (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
alias cp='cp -iv'
alias rm='rm -iv'
alias mv='mv -iv'

# Git
alias lg='lazygit'
alias gs='git status'
alias ga='git add'
alias gb='git branch'
alias gc='git commit'
alias gd='git diff'
alias go='git checkout'
alias gl='git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'

# Nixos
alias ras='sudo nixos-rebuild switch --flake .#'

# Tmux
tm() {
  if [ -n "$1" ]; then
    # If an argument is provided, try to attach to it or create it.
    tmux attach-session -t "$1" 2>/dev/null || tmux new-session -s "$1"
  elif tmux has-session 2>/dev/null; then
    # No argument? Open the alphabetical list.
    tmux attach-session \; choose-tree -sZ -O name
  else
    # Nothing running? Fresh start.
    tmux
  fi
}