-
Notifications
You must be signed in to change notification settings - Fork 0
/
.commonbashrc
41 lines (33 loc) · 1.57 KB
/
.commonbashrc
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
source "$HOME/.commonrc"
alias sr="export MANUALLY_SOURCING_RC=true && source $HOME/.bashrc && echo sourced bashrc;" # sr means: source .bashrc
alias vr="vim $HOME/.bashrc" # vr means: vim .bashrc
alias vcbrc="vim $HOME/.commonbashrc" # vcbrc means: vim .commonbashrc
[[ $- == *i* ]] && stty -ixon # Allows for forward search via ctrl + s
shopt -s autocd # allows you to cd into a directory by just typing its name
# e.g. typing ".." will cd into the parent directory
HISTCONTROL=ignorespace # don't remember commands that are ran and started with a space
HISTCONTROL=ignoredups # don't remember commands that are ran twice in a row
# fzf complete makefile commands: https://stackoverflow.com/a/71966611/4647924
complete -W "\`grep -oE '^[a-zA-Z0-9_.-]+[\\:]*[a-zA-Z0-9_.-]+:([^=]|$)' ?akefile | sort | uniq | sed 's/[^a-zA-Z0-9_.-]*$//' | sed 's/[\]//g' | fzf\`" make
# git brach auto completion
test -f "$HOME/.git-completion.bash" && . $_
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
print_before_the_prompt () { # makes it so the terminal lines have color
printf "\e[1;31m%s: \e[1;33m%s \e[1;92m%s \e[1;0m" "$USER" "$PWD" "$(parse_git_branch)"
}
PROMPT_COMMAND=print_before_the_prompt
export PS1='\n->'
export PATH=$PATH:/home/ec2-user/go/bin
# I tried putting this logic in .commonrc but it didn't work. it needs to be sourced at the end of the .bashrc file
export PATH="$HOME/.local/bin:$PATH"
eval "$(zoxide init bash)"
function cd(){
z "$@" &&
pwd > "$HOME/.last_dir"
}
function ccd(){
zi "$@" &&
pwd > "$HOME/.last_dir"
}