From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4774 invoked by alias); 20 Mar 2013 20:55:04 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17721 Received: (qmail 13457 invoked from network); 20 Mar 2013 20:54:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at trustfood.org does not designate permitted sender hosts) Date: Wed, 20 Mar 2013 21:54:48 +0100 From: Eric Smith To: zsh-users@zsh.org Subject: Re: truncating string in .zprofile Message-ID: References: <20130320194102.GB89285@phisen.local> <20130320204528.GC89285@phisen.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130320204528.GC89285@phisen.local> User-Agent: Mutt/1.5.21 (2010-09-15) -- 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.