prompt updatoor

This commit is contained in:
Bryan Ramos 2024-01-25 23:52:46 -05:00
parent e885a5427e
commit 3b68af8c91
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8

View file

@ -6,13 +6,20 @@ check_ssh() {
} }
function check_venv() { function check_venv() {
if [ -n "''${IN_NIX_SHELL}" ]; then if [ -n "$IN_NIX_SHELL" ]; then
if [ -n "$VIRTUAL_ENV" ]; then
python_icon="\[\033[01;33m\] \[\033[00m\]"
fi
nix_icon="\[\033[01;34m\] \[\033[00m\]" nix_icon="\[\033[01;34m\] \[\033[00m\]"
venv_icons+="$nix_icon"
if [ -n "$VIRTUAL_ENV" ]; then
python_icon="\[\033[01;31m\] \[\033[00m\]"
venv_icons+="$python_icon"
fi
if [ -d "''${git_root}/node_modules" ]; then
node_icon="\[\033[01;33m\]󰌞 \[\033[00m\]"
venv_icons+="$node_icon"
fi
else else
unset nix_icon python_icon unset venv_icons
fi fi
} }
@ -32,7 +39,7 @@ function check_git() {
git_branch=$(git rev-parse --short HEAD) git_branch=$(git rev-parse --short HEAD)
fi fi
local git_root=$(git rev-parse --show-toplevel) git_root=$(git rev-parse --show-toplevel)
local git_root_dir=$(basename "$git_root") local git_root_dir=$(basename "$git_root")
git_branch_PS1="\[\033[01;31m\]$git_branch 󰘬:\[\033[00m\]" git_branch_PS1="\[\033[01;31m\]$git_branch 󰘬:\[\033[00m\]"
@ -44,13 +51,15 @@ function set_prompt() {
local working_dir="\[\033[01;34m\]\w\[\033[00m\]" local working_dir="\[\033[01;34m\]\w\[\033[00m\]"
local green_arrow="\[\033[01;32m\]>> " local green_arrow="\[\033[01;32m\]>> "
local white_text="\[\033[00m\]" local white_text="\[\033[00m\]"
local git_root
local venv_icons
local git_branch_PS1
check_git
check_ssh check_ssh
check_venv check_venv
check_git
PS1="$ssh_PS1\n$working_dir\n$nix_icon$python_icon$green_arrow$git_branch_PS1$white_text" PS1="$ssh_PS1\n$working_dir\n$venv_icons$green_arrow$git_branch_PS1$white_text"
unset git_branch_PS1
} }
PROMPT_COMMAND="set_prompt" PROMPT_COMMAND="set_prompt"