blob: e85ef7eb57debbf1fcdb14d27706f35cba386b1b (
plain) (
blame)
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
|
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]]; then
# Shell is non-interactive. Be done now!
return
fi
# Put your fun stuff here.
# ignore commands starting with space
export HISTCONTROL=ignorespace
export HISTIGNORE='..:fg:clear:tig:git st::git pushf:git a'
export HISTSIZE=8000
# enable bash vi mode
set -o vi
bind -m vi-insert -x '"\C-l": clear'
readline_insert() {
local output=$(command $* || return)
READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}${output}${READLINE_LINE:$READLINE_POINT}"
READLINE_POINT=$((READLINE_POINT + ${#output}))
}
# <C-b> triggers git branch fuzzy finder
bind -m vi-command -x '"\C-g\C-b": "readline_insert git fuzzy branches"'
bind -m vi-insert -x '"\C-g\C-b": "readline_insert git fuzzy branches"'
# <C-l> triggers git commit fuzzy finder
bind -m vi-command -x '"\C-g\C-l": "readline_insert git fuzzy commits"'
bind -m vi-insert -x '"\C-g\C-l": "readline_insert git fuzzy commits"'
# aliases
alias ..='cd ..'
alias daos='doas '
alias doas='doas '
alias l='ls -hl --color'
alias lt=tree
alias vi=nvim
alias dbx=distrobox
alias eq=equery
alias fd='find . -name'
alias g=git
alias mk=make
alias open=xdg-open
alias poe='vifz /etc/portage/'
alias sshmux='ssh -o RequestTTY=yes -o RemoteCommand="tmux new-session -As $HOSTNAME"'
#alias task='task --trusted-hosts=github.com'
alias tw=timew
alias wlc=wl-copy
alias wlp=wl-paste
# enable fzf
[ -x "$(command -v fzf)" ] && {
export FZF_CTRL_R_OPTS="--layout=reverse"
export FZF_CTRL_T_OPTS="--layout=reverse"
eval "$(fzf --bash)"
alias vz='vi $(__fzf_select__)'
}
[ -e "$HOME/bin/fzf-git.sh" ] && {
source $HOME/bin/fzf-git.sh
alias gco='_fzf_git_each_ref --no-multi | xargs git checkout'
}
# enable direnv
[ -x "$(command -v direnv)" ] && eval "$(direnv hook bash)"
# enable starship
[ -x "$(command -v starship)" ] && eval "$(starship init bash)"
# enable zoxide
[ -x "$(command -v zoxide)" ] && eval "$(zoxide init bash)"
# enable atuin
# [ -x "$(command -v atuin)" ] && eval "$(ATUIN_NO_BUILTIN_PREEXEC=1 atuin init bash)"
# enable todo
[ -x "$(command -v todo)" ] && eval "$(todo hook bash)"
# enable autowt
[ -x "$(command -v autowt)" ] && eval "$(autowt shell-init bash)"
# modern terminal stuft
# https://codeberg.org/dnkl/foot/wiki#jumping-between-prompts
prompt_marker() {
printf '\e]133;A\e\\'
}
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }prompt_marker
# https://codeberg.org/dnkl/foot/wiki#piping-last-command-s-output
command_done() {
printf '\e]133;D\e\\'
}
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }command_done
PS0+='\e]133;C\e\\'
# 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
|