-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.bashrc
170 lines (146 loc) · 5.3 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# [[file:Console.org::*Startup & environment][Startup & environment:1]]
export SHELL
# Startup & environment:1 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:2]]
if [[ $- != *i* ]]
then
[[ -n "$SSH_CLIENT" && -f "/etc/bashrc" ]] && source /etc/profile
return
fi
# Startup & environment:2 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:3]]
if command -v termux-setup-storage > /dev/null; then
if [[ -z "$IS_ANDROID" ]]; then
source ~/.profile
fi
fi
# Startup & environment:3 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:4]]
if [[ -f "/etc/bashrc" ]]; then
source /etc/bashrc
fi
# Startup & environment:4 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:5]]
xhost +local:root > /dev/null 2>&1
# Startup & environment:5 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:6]]
export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
# Startup & environment:6 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:7]]
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"
# Startup & environment:7 ends here
# [[file:Console.org::*Launch fish][Launch fish:1]]
use_fish=true
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} && $(command -v fish) ]]
then
exec fish
fi
# Launch fish:1 ends here
# [[file:Console.org::*Colors][Colors:1]]
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
unset use_color safe_term match_lhs sh
# Colors:1 ends here
# [[file:Console.org::*Settings][Settings:1]]
complete -cf sudo # Sudo autocompletion
shopt -s checkwinsize # Check windows size after each command
shopt -s expand_aliases # Aliases
shopt -s autocd # Cd to directory just by typing its name (without cd)
# Settings:1 ends here
# [[file:Console.org::*Settings][Settings:2]]
shopt -s histappend
export HISTCONTROL=ignoredups:erasedups
HISTSIZE=
HISTFILESIZE=
# Settings:2 ends here
# [[file:Console.org::*Aliases][Aliases:1]]
alias v="vim"
if command -v exa > /dev/null; then
alias ls="exa --icons"
alias ll="exa -lah --icons"
else
alias ll='ls -lah'
fi
alias q="exit"
alias c="clear"
alias ci="init_mamba"
alias ca="micromamba activate"
alias cii="export INIT_MAMBA=true && init_mamba"
# Aliases:1 ends here
# [[file:Console.org::*Aliases][Aliases:2]]
if [[ ! -z "$SIMPLE" ]]; then
unalias ls
alias ll="ls -lah"
fi
# Aliases:2 ends here
# [[file:Console.org::*Micromamba][Micromamba:1]]
init_mamba () {
export MAMBA_EXE="/home/pavel/.guix-extra-profiles/dev/dev/bin/micromamba";
export MAMBA_ROOT_PREFIX="/home/pavel/micromamba";
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
if [ -f "/home/pavel/micromamba/etc/profile.d/micromamba.sh" ]; then
. "/home/pavel/micromamba/etc/profile.d/micromamba.sh"
else
export PATH="/home/pavel/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
fi
fi
unset __mamba_setup
}
if [[ ! -z "$INIT_MAMBA" ]]; then
init_mamba
fi
# Micromamba:1 ends here
# [[file:Console.org::*Starship][Starship:1]]
if [[ -z "$SIMPLE" && "$TERM" != "dumb" ]]; then
eval "$(starship init bash)"
fi
# Starship:1 ends here
# [[file:Console.org::*Yandex Cloud][Yandex Cloud:1]]
init_yc () {
# The next line updates PATH for Yandex Cloud CLI.
if [ -f '/home/pavel/yandex-cloud/path.bash.inc' ]; then source '/home/pavel/yandex-cloud/path.bash.inc'; fi
# The next line enables shell command completion for yc.
if [ -f '/home/pavel/yandex-cloud/completion.bash.inc' ]; then source '/home/pavel/yandex-cloud/completion.bash.inc'; fi
}
# Yandex Cloud:1 ends here