-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
153 lines (113 loc) · 3.23 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
#{{{ Prompt
# Git prompt in bash
# Set config variables first
GIT_PROMPT_ONLY_IN_REPO=1
# theme file is ~/.git-prompt-colors.sh
GIT_PROMPT_THEME=Custom
# Standard user prompt, VENV unusable until virtualenvwrapper is used
export PS1="\[\e[1;32m\]$PYENV_VERSION\[\e[m\]\[\e[1;32m\] \w \[\e[m\]\[\e[1;36m\]>\[\e[m\] "
#}}}
#{{{ Source files
source ~/.bash-git-prompt/gitprompt.sh
source ~/.bash-git-prompt/prompt-colors.sh
source /usr/share/bash-completion/completions/git
#}}}
#{{{ Exports - tools and PATH variable
# Standard executables locations
export PATH="$HOME/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
# Git prompt
export PATH="$HOME/.bash-git-prompt:$PATH"
# Golang executables
export GOPATH="$HOME/.go"
export PATH="$GOPATH:$PATH"
export PATH="$GOPATH/bin:$PATH"
# Rust - cargo installed binaries
export PATH="$HOME/.cargo/bin:$PATH"
# Python - PyEnv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# Common tools
export PAGER="less"
export MANPAGER="less"
export EDITOR="nvim"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/kbaran/var/google-cloud-sdk/path.bash.inc' ]; then . '/home/kbaran/var/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/home/kbaran/var/google-cloud-sdk/completion.bash.inc' ]; then . '/home/kbaran/var/google-cloud-sdk/completion.bash.inc'; fi
# LS_COLORS variable
#export LS_COLORS="$(vivid generate molokai)"
#}}}
#{{{ Binds
# Ctrl + O to invoke lfcd
bind '"\C-o":"lfcd\C-m"'
#}}}
#{{{ Functions
# lfcd - stay in the current lf's dir
lfcd () {
tmp="$(mktemp)"
fid="$(mktemp)"
lf -command '$printf $id > '"$fid"'' -last-dir-path="$tmp" "$@"
id="$(cat "$fid")"
archivemount_dir="/tmp/__lf_archivemount_$id"
if [ -f "$archivemount_dir" ]; then
cat "$archivemount_dir" | \
while read -r line; do
sudo umount "$line"
rmdir "$line"
done
rm -f "$archivemount_dir"
fi
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}
#}}}
#{{{ Aliases
# Colorize the ls output
alias ls='ls --color=auto'
# Use a long listing format
alias l='ls -al --color=auto'
# Show hidden files
alias l.='ls -d .* --color=auto'
# Use neovim instead of vim
alias vim='nvim'
# Use given tmux configuration file
alias tmux='tmux -f $HOME/.config/tmux/tmux.conf'
# Use nvim as pager
alias vless='nvim -u /usr/share/nvim/runtime/macros/less.vim'
# Gitflow aliases
alias ga='git add'
alias gc='git commit -m'
alias gp='git push'
alias gm='git merge'
alias gs='git status'
alias gd='git diff'
alias gl='git log --pretty=oneline'
#}}}
# {{{ SSH Agent
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*
eval $(ssh-agent -s) > /dev/null
else
export SSH_AGENT_PID=$(pgrep ssh-agent)
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*)
fi
#}}}
# {{{ Other configurations
# term colors fix
eval "$(dircolors)"
# enable py env
eval "$(pyenv init -)"
# kompose completion
source <(kompose completion bash)
# Starship prompt
eval "$(starship init bash)"
# }}}