@@ -8,96 +8,13 @@ export TERM=xterm-256color
88export LC_ALL=en_US.UTF-8
99export PAGER=most
1010
11- # Prompt configuration
12- # Colors
13- RESET=" \[\033[0m\]"
14- RED=" \[\033[0;31m\]"
15- YELLOW=" \[\033[0;33m\]"
16- BLUE=" \[\033[0;34m\]"
17- WHITE=" \[\033[0;37m\]"
18- GREEN=" \[\033[0;32m\]"
19- PURPLE=" \[\033[0;35m\]"
20-
21- # Git prompt symbols
22- GIT_PROMPT_PREFIX=" ["
23- GIT_PROMPT_SUFFIX=" ]"
24- GIT_PROMPT_SEPARATOR=" |"
25- GIT_PROMPT_STAGED=" $RED ● "
26- GIT_PROMPT_CONFLICTS=" $RED ✖ "
27- GIT_PROMPT_CHANGED=" $BLUE ✚ "
28- GIT_PROMPT_UNTRACKED=" …"
29- GIT_PROMPT_STASHED=" ⚑ "
30- GIT_PROMPT_CLEAN=" $GREEN ✔"
31-
32- # Git status function
33- git_status () {
34- local branch staged conflicts changed untracked stashed clean
35-
36- # Get current branch
37- branch=$( git symbolic-ref HEAD 2> /dev/null)
38- if [[ -n " $branch " ]]; then
39- branch=${branch##*/ }
40-
41- # Count staged files
42- staged=$( git diff --staged --numstat | wc -l)
43- # Count conflicts
44- conflicts=$( git diff --name-only --diff-filter=U | wc -l)
45- # Count changed files
46- changed=$( git diff --numstat | wc -l)
47- # Count untracked files
48- untracked=$( git ls-files --others --exclude-standard | wc -l)
49- # Check if stash exists
50- if [[ -n $( git stash list) ]]; then
51- stashed=1
52- else
53- stashed=0
54- fi
55- # Check if clean
56- if [[ $staged -eq 0 && $conflicts -eq 0 && $changed -eq 0 && $untracked -eq 0 ]]; then
57- clean=1
58- else
59- clean=0
60- fi
61-
62- # Build status string
63- local status=" $GIT_PROMPT_PREFIX$PURPLE$branch$RESET$GIT_PROMPT_SEPARATOR "
64-
65- [[ $staged -gt 0 ]] && status+=" $GIT_PROMPT_STAGED "
66- [[ $conflicts -gt 0 ]] && status+=" $GIT_PROMPT_CONFLICTS "
67- [[ $changed -gt 0 ]] && status+=" $GIT_PROMPT_CHANGED "
68- [[ $untracked -gt 0 ]] && status+=" $GIT_PROMPT_UNTRACKED "
69- [[ $stashed -gt 0 ]] && status+=" $GIT_PROMPT_STASHED "
70- [[ $clean -eq 1 ]] && status+=" $GIT_PROMPT_CLEAN "
71-
72- echo -n " $status$RESET$GIT_PROMPT_SUFFIX "
73- fi
74- }
75-
76- # Set prompt command
77- PROMPT_COMMAND=__prompt_command
78-
79- __prompt_command () {
80- local EXIT=" $? "
81- local PATH_SHORT=" ${PWD/# $HOME / \~ } "
82- local TIME=" \$ (date +%R)"
83-
84- PS1=" $YELLOW$PATH_SHORT$RESET "
85-
86- # Add git status if in a git repository
87- if git rev-parse --git-dir > /dev/null 2>&1 ; then
88- PS1+=" \$ (git_status)"
89- fi
90-
91- PS1+=" \n$WHITE$TIME$RESET \$ "
92- }
93-
94- # rbenv setup
11+ # Ruby
9512if command -v rbenv > /dev/null 2>&1 ; then
9613 export PATH=" $HOME /.rbenv/bin:$PATH "
9714 eval " $( rbenv init -) "
9815fi
9916
100- # nvm setup
17+ # Node
10118export NVM_DIR=" $HOME /.nvm"
10219export NVM_DEFAULT_VERSION=20
10320
@@ -107,36 +24,32 @@ if [ -d "$NVM_DIR" ]; then
10724 command -v nvm > /dev/null 2>&1 && nvm use " $NVM_DEFAULT_VERSION " > /dev/null 2>&1
10825fi
10926
110- # golang configuration
27+ # Golang
11128if command -v go > /dev/null 2>&1 ; then
11229 export GOPATH=" $HOME /dev/go"
11330fi
11431
115- # brew configuration
32+ # Brew
11633if command -v brew > /dev/null 2>&1 ; then
11734 alias python=/opt/homebrew/bin/python3
11835fi
11936
120- # PATH modifications
37+ # Rust
12138if [ -d " $HOME /.cargo/bin" ]; then
12239 export PATH=" $HOME /.cargo/bin:$PATH "
12340fi
12441
125- # Vi mode
12642set -o vi
12743
12844# Aliases
12945alias ll=' ls -lF'
13046alias la=' ls -lA'
13147alias git=' hub'
13248
133- # Load all configurations from conf.d
134- if [ -d " $HOME /.config/bash/conf.d" ]; then
135- for file in " $HOME /.config/bash/conf.d" /* .sh; do
136- [ -r " $file " ] && source " $file "
137- done
49+ # Prompt setup
50+ if [ -f " $HOME /.config/bash/prompt.bash" ]; then
51+ source " $HOME /.config/bash/prompt.bash"
13852fi
13953
14054# Load local customizations if they exist
141- [ -f " $HOME /.bashrc.local" ] && source " $HOME /.bashrc.local"
142-
55+ [ -f " $HOME /.bashrc.local" ] && source " $HOME /.bashrc.local"
0 commit comments