-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
99 lines (76 loc) · 2.49 KB
/
bashrc
File metadata and controls
99 lines (76 loc) · 2.49 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
#
# ~/.bashrc
#
## Defaults
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
## Source other files
# copy from /etc/skel/.bashrc if not available
[[ -f ~/.extend.bashrc ]] && . ~/.extend.bashrc
[[ -f ~/.bashrc.work ]] && . ~/.bashrc.work
[[ -f ~/.bashrc.manjaro ]] && . ~/.bashrc.manjaro
[[ -f ~/.bashrc.pi ]] && . ~/.bashrc.pi
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
## Haskell GHC
[ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && source "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"
# autocompletion for stack
[ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && eval "$(stack --bash-completion-script stack)"
## Env variables
export EDITOR=vim
## History settings
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
## Custom prompt
# Save and reload the history after each command finishes - same history in all tabs
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
### Git Prompt
if [ -f "$HOME/dotfiles/bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_THEME="Single_line_Dark"
source $HOME/dotfiles/bash-git-prompt/gitprompt.sh
fi
## Aliases and functions
### Common
alias ll='ls -lha'
### Git
gitCommitAndPush() {
git commit -m "$1"
git push
}
gitCheckoutByGrep() {
branch_name=$1
git checkout $(git branch | grep $branch_name)
}
alias gp='git pull'
alias gs='git status'
alias ga='git add .; git status'
alias gac='git add .; gitCommitAndPush'
alias gc='gitCommitAndPush'
alias gd='git diff'
alias gr='git checkout -- .'
alias gm='gp; git checkout -B master origin/master'
alias gco='gitCheckoutByGrep'
alias gac='git add .; git commit -m'