-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc_xeioex
More file actions
138 lines (113 loc) · 3.19 KB
/
Copy path.bashrc_xeioex
File metadata and controls
138 lines (113 loc) · 3.19 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
137
138
#! /bin/bash
# Generic routines
__source-if-exist() {
if [ -f "$1" ]; then
. "$1"
fi
}
__create-if-not-exist() {
if [ ! -d "$1" ]; then
mkdir -p "$1" 2>/dev/null
fi
}
__path_prepend() {
if [ -d "$1" ]; then
case ":$PATH:" in
*":$1:"*) ;;
*) export PATH="$1:$PATH" ;;
esac
fi
}
__path_append() {
if [ -d "$1" ]; then
case ":$PATH:" in
*":$1:"*) ;;
*) export PATH="$PATH:$1" ;;
esac
fi
}
# Customization
__source-if-exist ~/.bashrc_user_profile
__source-if-exist ~/.bashrc_private
export PROJECT="$PROJECT"
export HOSTIP=$(ip addr | grep -E 'inet.*eth0' | grep -E -m 1 -o 'inet [0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed 's/inet //')
# Colors aliases
# Reset
Color_Off="\[\e[0m\]"
Color_OffE="\e[0m"
# Bold Regular Colors
Red="\[\033[1;31m\]"
RedE="\033[1;31m"
Green="\[\033[1;32m\]"
GreenE="\033[1;32m"
Yellow="\[\033[1;33m\]"
YellowE="\033[1;33m"
Blue="\[\033[1;34m\]"
BlueE="\033[1;34m"
Purple="\[\033[1;35m\]"
PurpleE="\033[1;35m"
Cyan="\[\033[1;36m\]"
CyanE="\033[1;36m"
White="\[\033[1;37m\]"
WhiteE="\033[1;37m"
# %b interprets backslash escapes in variables
info-message () {
printf "%b%s%b\n" "${GreenE}" "$1" "${Color_OffE}"
}
important-message () {
printf "%b%s%b\n" "${YellowE}" "$1" "${Color_OffE}"
}
warning-message () {
printf "%b%s%b\n" "${RedE}" "$1" "${Color_OffE}"
}
# bash-specific settings
if [ -n "$BASH_VERSION" ]; then
export PS1HOST="$Red $HOSTIP $Color_Off"
if [ "$HOSTIP" = "$BASEHOSTIP" ]; then
export HOSTIP='HOME'
export PS1HOST="$Green $HOSTIP $Color_Off"
fi
export SHELLRC="~/.bashrc_$USER"
export SHELLCMD="bash --rcfile $SHELLRC -i"
export PS1="$Yellow[\@] $Red\#$Red$PS1HOST$Blue\u@\h$Yellow \w\n$Color_Off\$ "
if [ -n "$(type -t __git_ps1 2>/dev/null)" ]; then
export PS1="\$(__git_ps1) $PS1"
fi
fi
__create-if-not-exist "$WORKSPACE"
# Sources
__source-if-exist /etc/bashrc
__source-if-exist ~/.cargo/env
__source-if-exist /usr/share/doc/cdargs/examples/cdargs-bash.sh
__source-if-exist /etc/bash_completion
export GOROOT=/usr/local/go
export GOPATH="$HOME/go"
__path_append "$HOME/bin"
__path_append "$HOME/bin/depot_tools"
__path_prepend "$GOPATH/bin"
__path_prepend "$GOROOT/bin"
__path_prepend "$HOME/bin/node-v25.2.1-linux-arm64/bin"
# Aliases
alias ss=". $SHELLRC"
alias ainstall='sudo apt-get install'
alias asearch='sudo apt-cache search'
alias vim="env --unset=DISPLAY nvim -u ~/.vimrc"
alias cursor-invisible='tput cinvis'
alias cursor-visible='tput cnorm'
alias reload-ssh-agent='eval `ssh-agent -s`; ssh-add ~/.ssh/nginx_id_rsa'
alias ssh-copy-id='ssh-copy-id -i ~/.ssh/id_rsa.pub'
alias tmux-enter-dev="~/.tmux/${PROJECT:+${PROJECT}-}dev"
alias tmux-enter-aux="~/.tmux/${PROJECT:+${PROJECT}-}aux"
alias tmux-kill-dev='tmux kill-session -t dev'
alias tmux-kill-aux='tmux kill-session -t aux'
vim-enter-session() {
info-message "Running vim..."
vim -S ~/.vimrc
}
vim-enter-clean-session() {
rm -fr ~/.vim/backups/*
rm -fr ~/.vim/sessions/"$USER-$1.vim"
vim-enter-session "$1"
}
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
[ -f "$HOME/.local/bin/env" ] && . "$HOME/.local/bin/env"