zsh-users
 help / color / mirror / code / Atom feed
From: Eric Smith <Eric.Smith@trustfood.org>
To: zsh-users@zsh.org
Subject: Re: truncating string in .zprofile
Date: Wed, 20 Mar 2013 21:54:48 +0100	[thread overview]
Message-ID: <mailbox-25186-1363812608-77606@pepper.0.0.200> (raw)
In-Reply-To: <20130320204528.GC89285@phisen.local>


-- 
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.


  reply	other threads:[~2013-03-20 20:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 18:28 Eric Smith
2013-03-20 19:41 ` Paul Hoffman
2013-03-20 20:17   ` Eric Smith
2013-03-20 20:45     ` Paul Hoffman
2013-03-20 20:54       ` Eric Smith [this message]
2013-03-21 12:34         ` Paul Hoffman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailbox-25186-1363812608-77606@pepper.0.0.200 \
    --to=eric.smith@trustfood.org \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).