-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
136 lines (111 loc) · 3.26 KB
/
Copy path.bashrc
File metadata and controls
136 lines (111 loc) · 3.26 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
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
133
134
135
136
# .bashrc of Patrick Winter <patrickwinter@posteo.ch>
# Don't load .bashrc further if I connect with TRAMP to this machine
if [[ $TERM = dumb ]]; then
return
fi
# Use emacs keybindings
set -o emacs
# Environment variables
export EDITOR="emacsclient -nw"
# Add custom scripts to $PATH
export PATH="$HOME/bin:$PATH"
# Ignore commands that start with a whitespace and only deduplicate history
export HISTCONTROL='ignorespace:erasedups'
# Store timestamps of commands .bash_history
export HISTTIMEFORMAT='%Y-%m-%d %T '
# Ignore with less then 3 characters
export HISTIGNORE='?:??:history'
# Append to .bash_history instead of overwritting it
shopt -s histappend
# Don't autoexecute history expansion (e.g. !!), show them for review
shopt -s histverify
# Combine multiline commands into one in history
shopt -s cmdhist
# Use embedded newlines rather than semicolons when storing multiline commands
shopt -s lithist
# Unlimited number of lines in .bash_history
export HISTFILESIZE=-1
# Unlimited number of lines that are stored in memory while running a bash session
export HISTSIZE=100000
# Append unflushed in-memory history entries to ~/.bash_history and load missing
# history entries from file into memory.
export PROMPT_COMMAND="history -a; history -c; history -r"
# Typing a directory name just by itself will automatically change
# into that directory.
shopt -s autocd
# Automatically fix directory name typos when changing directory.
shopt -s cdspell
# Automatically expand directory globs and fix directory name typos whilst
# completing. Note, this works in conjuction with the cdspell option listed
# above.
shopt -s direxpand dirspell
# Enable the ** globstar recursive pattern in file and directory expansions
shopt -s globstar
# Prompt format.
BOLD=$(tput bold)
RESET=$(tput sgr0)
PS1="\[${RESET}\]\[${BOLD}\]\w\[${RESET}\] "
# Functions
o() {
case "$1" in
http://*|https://*)
firefox "$1" &
;;
*.pdf)
zathura "$1" &
;;
*.mkv|*.mp4)
mpv "$1" &
;;
*.jpg|*.jpeg|*.png|*.tiff)
feh "$1" &
;;
*)
command /run/current-system/sw/bin/xdg-open "$@" &
;;
esac
}
# Aliases
alias l='ls -CF'
alias ls="ls --color"
alias la='ls -ACF'
alias ll='ls -AhlF'
alias c="cd"
alias ..="cd .."
alias ...="cd ../.."
alias cdv='cd ~/vcs'
alias cds='cd ~/shared'
alias h='history'
alias grep='grep --color=auto'
alias e='emacsclient -nw'
alias r='just'
alias m='make'
alias da='direnv allow'
alias er='systemctl --user restart emacs'
alias g='git'
alias t='tmux'
alias p='pytest'
alias dc="docker-compose"
alias b="firefox"
alias w="watch "
alias zb="zig build"
alias zt="zig test"
alias zr="zig run"
alias k="kubectl"
alias ns="kubectl config view --minify --output 'jsonpath={..namespace}'; echo"
alias ctx="kubectl config view --minify --output 'jsonpath={..context.cluster}'; echo"
alias kctx="kubectx"
alias kns="kubens"
alias ae='deactivate &> /dev/null; source .venv/bin/activate'
alias de='deactivate'
# Configure completion for shell aliases
if command -v complete_alias &>/dev/null; then
source "$(command -v complete_alias)"
complete -F _complete_alias r k g dc t
fi
# Wire up fuzzy finder
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# Wire up direnv
eval "$(direnv hook bash)"
# Wire up zoxide
eval "$(zoxide init --cmd j bash)"