summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-03-09 14:15:58 +0100
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-03-09 15:16:36 +0100
commit286edca6a2971be3852be898ff9297ea8f672ad0 (patch)
treef7dd77379529d61f75fd2c05e6058f5f3bbda045
parent8ca053002b72e57f0e63a8e40144e39123a9280d (diff)
[Prompt] preexec : YAHAHAAAA !
-rw-r--r--12_Prompts.zsh11
-rw-r--r--13_ZshHighlight.zsh4
2 files changed, 9 insertions, 6 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 7ec76fd..d96dd2e 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -57,8 +57,8 @@ chpwd()
__expand_text()
{
- # strips the %{...%} and newlines characters
- print -Pn -- "$(echo $@ | tr -d '\n' | sed 's/%{[^(%})]*%}//g;s/'$T_'//g;s/'$_T'//g')"
+ # strips the %{...%} and everything after \r characters
+ print -Pn -- "$(echo $@ | sed 's/\r.*//g;s/%{[^(%})]*%}//g;s/'$T_'//g;s/'$_T'//g')"
}
export _COLUMNS_OLD=0
@@ -87,11 +87,14 @@ preexec ()
__hbar
__redefine_prompt
- local lines="$(($( (__expand_text "$PROMPT";__expand_text "$1") | sed "s/\\(.\{0,$COLUMNS\}\\)/\\1\\n/g" | wc -l)))"
+ local lines
+ lines=$( (__expand_text "$PS1 $1" ) | sed "s/\\(.\{,$COLUMNS\}\\)/\\1\n/g" )
+ lines=$( echo "$lines" | sed -n '/^$/n;p' | wc -l )
tput sc
for i in {1..$lines} ; tput cuu1
- print -Pn "$PROMPT"
+ print -Pn "$PS1"
tput rc
+ #print -Pn $C_"30"$_C"-$(echo -n "$1" | wc -l)-> ${(q)1} <-"$lines"-\n"
print -Pn "$C_$_prompt_colors[exec]$_C"
}
diff --git a/13_ZshHighlight.zsh b/13_ZshHighlight.zsh
index 3005220..93f8e01 100644
--- a/13_ZshHighlight.zsh
+++ b/13_ZshHighlight.zsh
@@ -11,9 +11,9 @@ then
fi
-ZSH_HIGHLIGHT_STYLES[default]="none"
+ZSH_HIGHLIGHT_STYLES[default]="fg=cyan"
-ZSH_HIGHLIGHT_STYLES[assign]="none"
+ZSH_HIGHLIGHT_STYLES[assign]="fg=cyan"
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]="fg=yellow,bold"
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]="green"