-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
136 lines (113 loc) · 3.46 KB
/
bashrc
File metadata and controls
136 lines (113 loc) · 3.46 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
# If not running interactively, don't do anything (leave this at the top of this file)
[[ $- != *i* ]] && return
# ===== PATH & Cargo =====
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
export PATH="$PATH:$HOME/.local/bin/"
# ===== History =====
HISTFILE=~/.bash_history
HISTSIZE=1000000000
HISTFILESIZE="${HISTSIZE}"
HISTCONTROL=ignoredups:erasedups
shopt -s histappend
# ===== Shell Config =====
# Emacs keybindings
set -o emacs
force_color_prompt=yes
color_prompt=yes
if [[ -v SSH_TTY ]]; then
export PS1="\\[\\e[38;2;255;255;0m\\]\\u\\[\\e[0m\\]\\[\\e[38;2;0;204;204m\\]@\\[\\e[0m\\]\\[\\e[38;2;97;175;239m\\]\\h\\[\\e[0m\\] \\[\\e[38;2;152;195;121m\\]\\w\\[\\e[0m\\] \\[\\e[38;2;66;68;90m\\]\\\$\\[\\e[0m\\] "
else
export PS1="\\[\\e[38;2;97;175;239m\\]\\u\\[\\e[0m\\]\\[\\e[38;2;0;204;204m\\]@\\[\\e[0m\\]\\[\\e[38;2;97;175;239m\\]\\h\\[\\e[0m\\] \\[\\e[38;2;152;195;121m\\]\\w\\[\\e[0m\\] \\[\\e[38;2;66;68;90m\\]\\\$\\[\\e[0m\\] "
fi
# Autocompletion
if [[ ! -v BASH_COMPLETION_VERSINFO && -f /usr/share/bash-completion/bash_completion ]]; then
source /usr/share/bash-completion/bash_completion
fi
if command -v fzf &> /dev/null; then
if [[ -f /usr/share/fzf/completion.bash ]]; then
source /usr/share/fzf/completion.bash
fi
if [[ -f /usr/share/fzf/key-bindings.bash ]]; then
source /usr/share/fzf/key-bindings.bash
fi
fi
bind 'set completion-ignore-case on'
bind 'set show-all-if-ambiguous on'
bind 'set show-all-if-unmodified on'
bind 'set completion-query-items 200'
bind 'set visible-stats on'
bind 'set match-hidden-files off'
bind 'set page-completions off'
bind 'set skip-completed-text on'
bind 'set colored-stats on'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\e[C": forward-char'
bind '"\e[D": backward-char'
# ===== Environment =====
export EDITOR="nvim"
export SUDO_EDITOR="$EDITOR"
export VISUAL="nvim"
if command -v fzf &> /dev/null; then
if [[ -f /usr/share/fzf/completion.bash ]]; then
source /usr/share/fzf/completion.bash
fi
if [[ -f /usr/share/fzf/key-bindings.bash ]]; then
source /usr/share/fzf/key-bindings.bash
fi
fi
# ===== Aliases =====
alias e=" $EDITOR "
alias grep="grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} "
alias egrep="grep -E "
if command -v eza &>/dev/null; then
alias ls="eza -h "
else
alias ls="ls -h --color=auto "
fi
alias ff="fzf --preview 'bat --style=numbers --color=always {}'"
# ls chain to make life simplier
alias la="ls -a "
alias ll="la -l --icons=auto "
alias lru="ll -r "
alias l="ll "
alias ..="cd .."
alias ...="cd ../../"
alias ....="cd ../../../"
alias f1="awk '{print \$1}'"
alias f2="awk '{print \$2}'"
alias f3="awk '{print \$3}'"
alias f4="awk '{print \$4}'"
alias f5="awk '{print \$4}'"
alias sc="systemctl "
alias scu="systemctl --user "
alias jc="journalctl "
alias jcu="journalctl --user "
# Temporary edit file
etemp() {
local tmpfile
tmpfile="$(mktemp)"
echo -n "Opening tempfile at " 1>2
echo "$tmpfile"
"$EDITOR" "$tmpfile"
}
# Quick Navigation
alias docs="cd ~/Documents"
alias dl="cd ~/Downloads"
alias dots="cd ~/dotfiles"
alias proj="cd ~/Projects"
alias h="cd $HOME"
alias ee="e ~/.bashrc && source ~/.bashrc"
alias eee="e ~/.config/nvim"
# Git Shortcuts
alias gita="git add"
alias gitc="git commit"
alias gitca="git commit -a"
alias gitco="git checkout"
alias gitf="git fetch"
alias gitl="git log"
alias gitp="git pull"
alias gitpu="git push"
alias gitr="git rebase"
alias gits="git status"
alias gitd="git diff"