Fixes formatting on some rare cases when a percent ends up
in the $CMD variable, like these below:
- When assigning a variable, $CMD ends up with the second parameter;
in this case, $CMD will contain '+%s%N', messing with the syntax:
$ a=`date +%s%N`
- A function (or command in general) that contains a percent symbol:
$ to\%() { echo $(( $1 * 100 / $3))\% } # $CMD=to%()
$ to% 2 of 10 # $CMD=to%
Before this patch, commands containing %-signs set the title wrong
(urxvt and xterm) [1] and produce strange output in urxvt [2].
test for bug 1:
> sleep 10 && echo %
sets title to "sleep 10 && echo %<<"
> sleep 10 && echo %f
doesn't change the title at all
test for bug 2 (only urxvt):
> echo %f
39m%f
^^^^^----- output
Term window title and tab title are now skinable
Tab title can be different from window title (when supported by term)
Default theme is optimized of usuability (no %u@%m: $~ in a 10 char tab)
Cleanup code duplication and add comment for supported terms
On osX it works great on iterm, and is decent once you tweak Terminal pref
Tested under GNU screen, iTerm and Apple Terminal, need to be tested on linux
TODO implement Konsole support (via dbus)