Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cning112 committed Jun 14, 2024
1 parent 0fad565 commit c4c2868
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 42 deletions.
43 changes: 9 additions & 34 deletions .bash_profile
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
shopt -s autocd
shopt -s histappend

export HISTSIZE=5000
export HISTFILESIZE=10000

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
bldgrn='\e[1;32m' # Bold Green
bldpur='\e[1;35m' # Bold Purple
txtrst='\e[0m' # Text Reset

emojis=("👾" "🌐" "🎲" "🌍" "🐉" "🌵")

EMOJI=${emojis[$RANDOM % ${#emojis[@]} ]}

print_before_the_prompt () {
dir=$PWD
home=$HOME
dir=${dir/"$HOME"/"~"}
printf "\n $txtred%s: $bldpur%s $txtgrn%s\n$txtrst" "$HOST_NAME" "$dir" "$(vcprompt)"
}

PROMPT_COMMAND=print_before_the_prompt
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
PS1="$EMOJI >"

source ~/.commonrc
# 加载系统范围的配置文件
if [ -f /etc/profile ]; then
. /etc/profile
fi

# 加载用户的 .bashrc
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
37 changes: 37 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
shopt -s autocd
shopt -s histappend

export HISTSIZE=5000
export HISTFILESIZE=10000

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
bldgrn='\e[1;32m' # Bold Green
bldpur='\e[1;35m' # Bold Purple
txtrst='\e[0m' # Text Reset

emojis=("👾" "🌐" "🎲" "🌍" "🐉" "🌵")

EMOJI=${emojis[$RANDOM % ${#emojis[@]} ]}

print_before_the_prompt () {
dir=$PWD
home=$HOME
dir=${dir/"$HOME"/"~"}
printf "\n $txtred%s: $bldpur%s $txtgrn%s\n$txtrst" "$HOST_NAME" "$dir" "$(vcprompt)"
}

PROMPT_COMMAND=print_before_the_prompt
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
PS1="$EMOJI >"

source ~/.commonrc

# Always Warpify the subshell
printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "bash" }}\x9c'
13 changes: 5 additions & 8 deletions .commonrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ fi
unset __conda_setup
# <<< conda initialize <<<

# Initialize warpify if available
if command -v warpify &> /dev/null; then
eval "$(warpify init bash)"
eval "$(warpify init zsh)"
fi

# Initialize zoxide if available
if command -v zoxide &> /dev/null; then
eval "$(zoxide init bash)"
eval "$(zoxide init zsh)"
if [ -n "$ZSH_VERSION" ]; then
eval "$(zoxide init zsh)"
elif [ -n "$BASH_VERSION" ]; then
eval "$(zoxide init bash)"
fi
fi

# Rust 和 Cargo 环境变量(如果已安装)
Expand Down
3 changes: 3 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ source $ZSH/oh-my-zsh.sh
source ~/.commonrc

export EDITOR='vi'

# Always Warpify the subshell
printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "zsh" }}\x9c'

0 comments on commit c4c2868

Please sign in to comment.