-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path.bashrc
More file actions
55 lines (42 loc) · 1.44 KB
/
Copy path.bashrc
File metadata and controls
55 lines (42 loc) · 1.44 KB
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
# yt-dlp needs browser cookies to pass YouTube's bot check (terminal needs Full Disk Access)
export SUMMARIZE_YT_DLP_COOKIES_FROM_BROWSER=chrome
[[ $- == *i* ]] || return
# --- history ---
mkdir -p ~/bash_history
__sess=~/bash_history/$(hostname -s).$$
HISTFILE=~/bash_history/$(hostname -s).hist
HISTSIZE=10000
HISTFILESIZE=
HISTTIMEFORMAT='%F %T '
shopt -s histappend
# rich per-session log: timestamp <TAB> cwd <TAB> command
log_cmd() {
local HISTTIMEFORMAT= n cmd ts
read -r n cmd <<<"$(history 1)"
[[ $n == "$__last_hist_n" ]] && return
__last_hist_n=$n
printf -v ts '%(%F %T)T' -1
printf '%s\t%s\t%s\n' "$ts" "$PWD" "$cmd" >>"$__sess.tsv"
}
# --- shell options ---
shopt -s extglob globstar checkjobs
eval "$(/opt/homebrew/bin/brew shellenv bash)"
eval "$(direnv hook bash)"
eval "$(zoxide init bash --cmd j)"
eval "$(fzf --bash)"
PROMPT_COMMAND+=('history -a; history -n' log_cmd)
alias vim=nvim
alias svim='sudo --preserve-env=HOME nvim'
alias codex='codex --yolo'
alias rg='rg --max-columns=200 --max-columns-preview'
alias ll="ls -lah"
alias sts='aws sts get-caller-identity'
alias today='date -u +%Y-%m-%d'
alias ga='git commit -a'
[[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]] &&
. "$(brew --prefix)/etc/profile.d/bash_completion.sh"
PS1='$(ret=$?; if [[ $ret -ne 0 ]]; then printf "\[\e[31m\]"; fi)\W \$ \[\e[0m\]'
h() {
rg -a -g '*.tsv' "$@" ~/bash_history/
}
export PATH="$HOME/.local/bin:$HOME/bin:$HOME/go/bin:$PATH"