Add spaceship configuration
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "zsh/spaceship-prompt"]
|
||||
path = zsh/spaceship-prompt
|
||||
url = https://github.com/spaceship-prompt/spaceship-prompt.git
|
||||
1
zsh/spaceship-prompt
Submodule
1
zsh/spaceship-prompt
Submodule
Submodule zsh/spaceship-prompt added at 689a04c10a
15
zsh/spaceship.zsh
Normal file
15
zsh/spaceship.zsh
Normal file
@@ -0,0 +1,15 @@
|
||||
# Time
|
||||
SPACESHIP_TIME_SHOW=true
|
||||
SPACESHIP_TIME_COLOR=yellow
|
||||
|
||||
# Directory
|
||||
SPACESHIP_DIR_TRUNC=3
|
||||
SPACESHIP_DIR_TRUNC_REPO=false
|
||||
SPACESHIP_DIR_COLOR=cyan
|
||||
|
||||
# Git
|
||||
SPACESHIP_GIT_SHOW=true
|
||||
SPACESHIP_GIT_BRANCH_SHOW=true
|
||||
SPACESHIP_GIT_STATUS_SHOW=true
|
||||
SPACESHIP_GIT_STATUS_PREFIX=" ["
|
||||
SPACESHIP_GIT_STATUS_SUFFIX="]"
|
||||
150
zshrc
150
zshrc
@@ -48,80 +48,84 @@ fts() {
|
||||
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --preview "tmux list-windows -t {} | column -t" --preview-window=down:20%) && tmux switch-client -t "$session"
|
||||
}
|
||||
|
||||
# Enhanced Zsh Prompt Configuration
|
||||
# Spaceship Prompt
|
||||
source ~/.dotfiles/zsh/spaceship-prompt/spaceship.zsh-theme
|
||||
source ~/.dotfiles/zsh/spaceship.zsh
|
||||
|
||||
# Enhanced Zsh Prompt Configuration (replaced by Spaceship)
|
||||
# Enable prompt substitution and colors
|
||||
setopt PROMPT_SUBST
|
||||
autoload -U colors && colors
|
||||
# setopt PROMPT_SUBST
|
||||
# autoload -U colors && colors
|
||||
|
||||
# Git prompt function
|
||||
git_prompt_info() {
|
||||
local ref
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
# git_prompt_info() {
|
||||
# local ref
|
||||
# ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
# ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
#
|
||||
# # Get git status
|
||||
# local git_status=""
|
||||
# local STATUS=$(git status --porcelain 2> /dev/null | tail -1)
|
||||
#
|
||||
# if [[ -n $STATUS ]]; then
|
||||
# git_status=" %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
# else
|
||||
# git_status=" %{$fg[green]%}✓%{$reset_color%}"
|
||||
# fi
|
||||
#
|
||||
# echo " %{$fg[cyan]%}(${ref#refs/heads/}${git_status}%{$fg[cyan]%})%{$reset_color%}"
|
||||
# }
|
||||
#
|
||||
# # Virtual environment indicator
|
||||
# virtualenv_prompt_info() {
|
||||
# if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||
# echo "%{$fg[magenta]%}($(basename $VIRTUAL_ENV))%{$reset_color%} "
|
||||
# fi
|
||||
# }
|
||||
#
|
||||
# # Exit code indicator
|
||||
# exit_code_prompt() {
|
||||
# echo "%(?.%{$fg[green]%}➜%{$reset_color%}.%{$fg[red]%}➜%{$reset_color%})"
|
||||
# }
|
||||
#
|
||||
# # Directory with truncation
|
||||
# directory_prompt() {
|
||||
# echo "%{$fg[blue]%}%3~%{$reset_color%}"
|
||||
# }
|
||||
#
|
||||
# # Username and hostname for SSH sessions
|
||||
# user_host_prompt() {
|
||||
# if [[ -n "$SSH_CONNECTION" ]]; then
|
||||
# echo "%{$fg[yellow]%}%n@%m%{$reset_color%} "
|
||||
# fi
|
||||
# }
|
||||
#
|
||||
# # Time in 24-hour format
|
||||
# time_prompt() {
|
||||
# echo "%{$fg[lightgray]%}%T%{$reset_color%}"
|
||||
# }
|
||||
#
|
||||
# # Main prompt
|
||||
# PROMPT='$(user_host_prompt)$(virtualenv_prompt_info)$(directory_prompt)$(git_prompt_info) $(exit_code_prompt) '
|
||||
#
|
||||
# # Right prompt with time
|
||||
# RPROMPT='$(time_prompt)'
|
||||
#
|
||||
# # Enable command execution time display
|
||||
# function preexec() {
|
||||
# timer=${timer:-$SECONDS}
|
||||
# }
|
||||
#
|
||||
# function precmd() {
|
||||
# if [ $timer ]; then
|
||||
# timer_show=$(($SECONDS - $timer))
|
||||
# if [ $timer_show -ge 3 ]; then
|
||||
# export RPS1="%{$fg[gray]%}${timer_show}s%{$reset_color%} $(time_prompt)"
|
||||
# else
|
||||
# export RPS1="$(time_prompt)"
|
||||
# fi
|
||||
# unset timer
|
||||
# fi
|
||||
# }
|
||||
|
||||
# Get git status
|
||||
local git_status=""
|
||||
local STATUS=$(git status --porcelain 2> /dev/null | tail -1)
|
||||
|
||||
if [[ -n $STATUS ]]; then
|
||||
git_status=" %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
else
|
||||
git_status=" %{$fg[green]%}✓%{$reset_color%}"
|
||||
fi
|
||||
|
||||
echo " %{$fg[cyan]%}(${ref#refs/heads/}${git_status}%{$fg[cyan]%})%{$reset_color%}"
|
||||
}
|
||||
|
||||
# Virtual environment indicator
|
||||
virtualenv_prompt_info() {
|
||||
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||
echo "%{$fg[magenta]%}($(basename $VIRTUAL_ENV))%{$reset_color%} "
|
||||
fi
|
||||
}
|
||||
|
||||
# Exit code indicator
|
||||
exit_code_prompt() {
|
||||
echo "%(?.%{$fg[green]%}➜%{$reset_color%}.%{$fg[red]%}➜%{$reset_color%})"
|
||||
}
|
||||
|
||||
# Directory with truncation
|
||||
directory_prompt() {
|
||||
echo "%{$fg[blue]%}%3~%{$reset_color%}"
|
||||
}
|
||||
|
||||
# Username and hostname for SSH sessions
|
||||
user_host_prompt() {
|
||||
if [[ -n "$SSH_CONNECTION" ]]; then
|
||||
echo "%{$fg[yellow]%}%n@%m%{$reset_color%} "
|
||||
fi
|
||||
}
|
||||
|
||||
# Time in 24-hour format
|
||||
time_prompt() {
|
||||
echo "%{$fg[lightgray]%}%T%{$reset_color%}"
|
||||
}
|
||||
|
||||
# Main prompt
|
||||
PROMPT='$(user_host_prompt)$(virtualenv_prompt_info)$(directory_prompt)$(git_prompt_info) $(exit_code_prompt) '
|
||||
|
||||
# Right prompt with time
|
||||
RPROMPT='$(time_prompt)'
|
||||
|
||||
# Enable command execution time display
|
||||
function preexec() {
|
||||
timer=${timer:-$SECONDS}
|
||||
}
|
||||
|
||||
function precmd() {
|
||||
if [ $timer ]; then
|
||||
timer_show=$(($SECONDS - $timer))
|
||||
if [ $timer_show -ge 3 ]; then
|
||||
export RPS1="%{$fg[gray]%}${timer_show}s%{$reset_color%} $(time_prompt)"
|
||||
else
|
||||
export RPS1="$(time_prompt)"
|
||||
fi
|
||||
unset timer
|
||||
fi
|
||||
}
|
||||
|
||||
source /home/jens/.config/broot/launcher/bash/br
|
||||
source /home/jenlue/.config/broot/launcher/bash/br
|
||||
|
||||
Reference in New Issue
Block a user