-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbashrc
135 lines (107 loc) · 4.16 KB
/
bashrc
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
#.bashrc
export LC_ALL="en_US.UTF-8"
export LC_CTYPE=en_US.UTF-8
export BASH_CONF="bashrc"
PATH=$PATH:/usr/local/bin
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
enable-sudo-touchid() {
sudo sed -i -e '1s;^;auth sufficient pam_tid.so\n;' /etc/pam.d/sudo
}
#GOPATH
export GOPATH=$HOME/Proyectos/personal/lang/go
#Arregla ejecucion de Ansible en Mac OS X High Sierra
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
#Arregla error sobre shell default (zsh) al iniciar terminal en Mac OS X
export BASH_SILENCE_DEPRECATION_WARNING=1
#Paginación de Systemd
#export SYSTEMD_PAGER=
#Habilita fzf en el prompt
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
#Auto-completar de AWS
complete -C '/usr/local/bin/aws_completer' aws
#Forzar prompt de color siempre
force_color_prompt=yes
#Macros universales
bind '"\t":menu-complete'
shopt -s histappend
shopt -s checkwinsize
#------------------------------------------------
#Variables
#Historial de Bash
HISTFILESIZE=999999
HISTSIZE=999999
HISTTIMEFORMAT="[%Y-%m-%d %H:%M:%S] "
HISTCONTROL="ignoreboth"
#Path principal
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/go/bin:$GOPATH/bin:$GOROOT/bin
export PATH
#Variables de utilidad
export BROWSER=/usr/bin/firefox
export EDITOR=/usr/bin/nano
export TERM=rxvt-256color
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
#Símbolos unicode aleatorios
rune=(☉ ⋇ ∴ ∵ ⊽ ꑛ ꐟ ꁹ ꂑ)
random_rune() {
selected_rune=${rune[$RANDOM % ${#rune[@]}]};
echo $selected_rune;
}
#Prompt universal, no lo cambio porque me encanta
if [[ $(whoami) == "manuel.fernandez" ]]; then
export PS1="${RESET}\[\e[01;32m\]manu\[$(tput sgr0)\]\[\033[38;5;15m\] @ \[$(tput sgr0)\]\[\033[38;5;208m\]ingenuity\[$(tput sgr0)\]\[\033[38;5;15m\] \[\033[38;5;12m\][\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;12m\]]\[$(tput sgr0)\]\[\033[38;5;15m\] \[\e[91m\]\$(parse_git_branch)\[\e[00m\] { \[$(tput sgr0)\]\[\033[38;5;28m\]\t\[$(tput sgr0)\]\[\033[38;5;15m\] } \\$ "
else
export PS1="${RESET}\[\e[01;32m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\] @ \[$(tput sgr0)\]\[\033[38;5;208m\]ingenuity\[$(tput sgr0)\]\[\033[38;5;15m\] : \[$(tput sgr0)\]\[\033[38;5;12m\][\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;6m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;12m\]]\[$(tput sgr0)\]\[\033[38;5;15m\] { \[$(tput sgr0)\]\[\033[38;5;28m\]\t\[$(tput sgr0)\]\[\033[38;5;15m\] } \\$ \[$(tput sgr0)\]"
fi
#------------------------------------------------
#Alias generales
alias bx='bash -x'
alias c="cd"
alias kp='pkill -P $1 $2'
alias man="batman"
alias passgen='LC_ALL=C tr -dc "A-Za-z0-9_!@#$%^&*()\-+=" < /dev/urandom | fold -w $(shuf -i 32-128) | head -n 4'
alias pod='popd'
alias prod='aws-mfa --profile default'
alias psf="ps -eo 'pid,args' --forest"
alias pud='pushd'
alias t='tmux -l -u -2'
alias tf="terraform"
alias tg="terragrunt"
alias nv="nvim"
#------------------------------------------------
#Booleans
#------------------------------------------------
###### Funciones ######
#Paginas man coloreadas
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
#Arregla errores de tipeo :joy:
function f() {
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_SHELL=bash;
export TF_ALIAS=fuck;
export TF_SHELL_ALIASES=$(alias);
export TF_HISTORY=$(fc -ln -10);
export PYTHONIOENCODING=utf-8;
TF_CMD=$(
thefuck THEFUCK_ARGUMENT_PLACEHOLDER "$@"
) && eval "$TF_CMD";
unset TF_HISTORY;
export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
history -s $TF_CMD;
}
#------------------------------------------------
source /Users/aux-admin/.config/broot/launcher/bash/br