aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorclaw0ry <me@claw0ry.net>2024-12-18 16:49:42 +0100
committerclaw0ry <me@claw0ry.net>2024-12-18 16:49:42 +0100
commit62980446536c83bdf339a2c28d671f4b728d7f39 (patch)
tree29bf95e779231640e8def2e69135f7b66f9a7b4c /.bashrc
parentvim: set commentstring for powershell (diff)
bashrc: fix bash prompt breaking
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc10
1 files changed, 5 insertions, 5 deletions
diff --git a/.bashrc b/.bashrc
index bc9b6af..c2dd073 100644
--- a/.bashrc
+++ b/.bashrc
@@ -45,24 +45,24 @@ __virtual_env_info() {
[ $VIRTUAL_ENV ] && echo "${VIRTUAL_ENV+(${VIRTUAL_ENV##*/})}"
}
__ps1() {
- local branch_color="\e[1;35m"
+ local branch_color='\[\e[1;35m\]'
local branch_prompt
local branch_prompt_clr
local git_branch=$(git branch --show-current 2>/dev/null)
local sign_prompt='\$'
- local sign_prompt_clr='\e[00m\$'
+ local sign_prompt_clr='\[\e[00m\]\$'
- [[ $git_branch == master || $git_branch == main ]] && branch_color="\e[31m"
+ [[ $git_branch == master || $git_branch == main ]] && branch_color='\[\e[31m\]'
[[ -n "$git_branch" ]] && branch_prompt_clr="$branch_color($git_branch)"
[[ -n "$git_branch" ]] && branch_prompt="($git_branch)"
[[ $EUID == 0 ]] && sign_prompt='#'
- [[ $EUID == 0 ]] && sign_prompt_clr='\e[31m#\e[00m'
+ [[ $EUID == 0 ]] && sign_prompt_clr='\[\e[31m\]#\[\e[00m\]'
case "$TERM" in
xterm-color|*-256color)
- PS1="\e[0;33m$(__virtual_env_info)\e[01;32m\u@\h\e[00m:\e[01;34m\W $branch_prompt_clr$sign_prompt_clr ";;
+ PS1="\\[\e[0;33m\\]$(__virtual_env_info)\\[\e[01;32m\\]\u@\h\\[\e[00m\\]:\\[\e[01;34m\\]\W $branch_prompt_clr$sign_prompt_clr ";;
*)
PS1="$(__virtual_env_info)\u@\h:\W $branch_prompt$sign_prompt ";;
esac