Skip to content

Instantly share code, notes, and snippets.

@jonohayon
Created June 4, 2016 13:17
Show Gist options
  • Save jonohayon/d855a44fb72edc983af0d85ad2a0ed50 to your computer and use it in GitHub Desktop.
Save jonohayon/d855a44fb72edc983af0d85ad2a0ed50 to your computer and use it in GitHub Desktop.
Ma' zsh theme
# Reset EVERYTHING!
unset TMOUT
unset RPROMPT
unset RPS1
function get_node_ver() {
echo "[⬢ $(node -v)]"
}
local get_time="$fg_bold[green]%T"
local user_info="$fg_bold[yellow]%n $fg_bold[red]@ $fg_bold[cyan]%~"
function prompt_row_upper_left() { echo "${get_time} ${user_info}" }
# function prompt_row_upper_left() { echo "$fg_bold[green]%T $fg_bold[yellow]%n $fg_bold[red]@ $fg_bold[cyan]%~" }
function prompt_row_upper_right() { echo "$(get_node_ver)" }
# function prompt_row_upper_left() { echo "a" }
# function prompt_row_upper_right() { echo "b" }
function put_spaces() {
# The filter
local zero='%([BSUbfksu]|([FBK]|){*})'
# Upper left
local upperleft="$(prompt_row_upper_left)"
upperleft=${#${(S%%)upperleft//$~zero/}}
# Upper right
local upperright="$(prompt_row_upper_right)"
upperright=${#${(S%%)upperright//$~zero/}}
# Desired spaces length
local termwidth
(( termwidth = $(tput cols) - ${upperleft} - ${upperright} ))
# Calculate spaces
local spacing=""
for i in {1..$termwidth}; do
spacing="${spacing} "
done
echo $spacing
}
PROMPT='$(prompt_row_upper_left)$(put_spaces)$(prompt_row_upper_right)
$fg_bold[blue]→ $fg_bold[red]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment