Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: truncating string in .zprofile



-- 
Best regards,
Eric Smith
Mobile: 00 31 6 455 09313 - Tel Wageningen: +31 317 728888

Paul Hoffman wrote on Wed-20-Mar 13  9:45PM
> On Wed, Mar 20, 2013 at 09:17:56PM +0100, Eric Smith wrote:
> > Yummy!
> 
> Correcting myself:
> 
> preexec() {
>     print -Pn "\033k\033\134\033k[${1[1,30]}]\033\134"
> }
> 
Funny, I did not even register those double quotes, just saw the
extra set of braces and then kicked myself, just like a solution
to many perl issues when you need an extra layer of eval.

I did this -
preexec () { print -Pn
"\033k\033\134\033k[${1[1,12]}..${1[-6,$]}]\033\134" }

How would I do arbitrary string searching and replacement in the `$1'?
Like to grab the top level domain from a URL or whatever.

Currently my window captions look like this:

[s asteri..vvvvv -c]  1 [vim .screenc..aptio]  4 [vim food..2013.txt]

Nice, but still a bit lame.



Messages sorted by: Reverse Date, Date, Thread, Author