summaryrefslogtreecommitdiff
path: root/dot-bashrc
blob: 4613e083516b47e412e11b532c91925465d8c771 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '

export EDITOR=nvim

# include home binaries
export PATH=$PATH:~/.bin

# enable globstar
shopt -s globstar

# firewall alias
alias fw="sudo firewall-cmd"

# use trash instead of rm
alias rm='echo "use trash instead"; false'
alias tm='trash-put'

# open using handlr
alias open='handlr open'

# lock desktop
alias lock='swaylock -f -c 000000'

# bluetooth
alias bt='bluetui'

# kitten ssh
alias kssh='kitten ssh'

# SSH Keychain
eval $(keychain --eval --quiet id_ed25519)

# fzf
export FZF_DEFAULT_OPTS="--preview='bat --color=always {}'"

# man syntax highlighting
export MANPAGER="sh -c 'awk '\''{ gsub(/\x1B\[[0-9;]*m/, \"\", \$0); gsub(/.\x08/, \"\", \$0); print }'\'' | bat -p -lman'"

# rclone
## logs
export RCLONE_COMBINED=~/.logs/rclone/combined.log
export RCLONE_DIFFER=~/.logs/rclone/differ.log
export RCLONE_ERROR=~/.logs/rclone/error.log
export RCLONE_MATCH=~/.logs/rclone/match.log
export RCLONE_MISSING_ON_DST=~/.logs/rclone/missing-on-dst.log
export RCLONE_MISSING_ON_SRC=~/.logs/rclone/missing-on-src.log
## settings
## specific to aws-like (Hetzner)
## see https://rclone.org/s3/#reducing-costs
## and https://rclone.org/s3/#increasing-performance
export RCLONE_FAST_LIST=true
export RCLONE_CHECKSUM=true
export RCLONE_TRANSFERS=200
export RCLONE_CHECKERS=200

# list packages installed explicitly, sorted by date
alias pacbd="cd && pacman -Qqe > pkglist.txt && expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | sed 's/^.*\s//' - | rg -f pkglist.txt -x"

# Query packages with fzf
# adapted from: https://www.reddit.com/r/archlinux/comments/xyjolo/using_fzf_to_search_pacman_database_including/
alias packages="pacman -Ss \
  | paste -d '' - - \
  | sed -e 's \/ \t ' \
  | fzf --multi --preview 'pacman -Siiv {2}' --tiebreak begin -e \
  | rg '\t([^\s]+)' -o --trim \
  | xargs -ro sudo pacman -S"

# Query installed packages with fzf
alias installed="pacman -Qqe \
  | xargs -rI{} rg -m1 'installed {} ' /var/log/pacman.log \
  | sort -r \
  | fzf --multi --with-nth 1,4 --accept-nth 4 --preview \"rg '(upgraded|installed|removed) {4} ' /var/log/pacman.log\" \
  | xargs -ro sudo pacman -Rns"

# distrobox dev environment
alias dev="distrobox enter dev"

# direnv
eval "$(direnv hook bash)"

# starship
eval "$(starship init bash)"

# include dev bashrc when in `dev` distrobox
if [ "$CONTAINER_ID" = "dev" ]; then
  source ~/.bashrc.d/dev.bashrc
fi