blob: 6f67d261ce65f134abc5adf1b6f8d0796133d90b (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
#
# ~/.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
# include bob (neovim) path
# goes first to take priority over standard nvim
export PATH=~/.local/share/bob/nvim-bin:$PATH
# enable globstar
shopt -s globstar
# firewall alias
alias fw="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 {}'"
# neovim as man pager
export MANPAGER="nvim +Man!"
# 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)"
# zoxide
eval "$(zoxide init bash)"
# include dev bashrc when in `dev` distrobox
if [ "$CONTAINER_ID" = "dev" ]; then
source ~/.bashrc.d/dev.bashrc
fi
# for spawning new terminal in cwd
# see https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory
osc7_cwd() {
local strlen=${#PWD}
local encoded=""
local pos c o
for (( pos=0; pos<strlen; pos++ )); do
c=${PWD:$pos:1}
case "$c" in
[-/:_.!\'\(\)~[:alnum:]] ) o="${c}" ;;
* ) printf -v o '%%%02X' "'${c}" ;;
esac
encoded+="${o}"
done
printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}"
}
PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%;}; }osc7_cwd
# Use `y` as a shell wrapper for Yazi
# Provides ability to change the cwd when exiting Yazi
# See https://yazi-rs.github.io/docs/quick-start/#shell-wrapper
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
command yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd"
/usr/bin/rm -f -- "$tmp"
}
|