From: Paul Hoffman <nkuitse@nkuitse.com>
To: zsh-users@zsh.org
Subject: Re: truncating string in .zprofile
Date: Wed, 20 Mar 2013 15:41:02 -0400 [thread overview]
Message-ID: <20130320194102.GB89285@phisen.local> (raw)
In-Reply-To: <mailbox-13443-1363803840-947330@pepper.0.0.200>
On Wed, Mar 20, 2013 at 07:28:27PM +0100, Eric Smith wrote:
> I have the following prexec() in my profile;
> preexec () { print -Pn "\033k\033\134\033k[$1]\033\134" }
>
> This prints the command in the screen caption for that window.
>
> What I want to do is limit this window title to n chars.
>
> However, I cannot manipulate the `$1' in the print string.
> Even if I try.
> substring=$1
> preexec () { print -Pn "\033k\033\134\033k[$substring]\033\134" }
>
> then there is no value printed for $substring.
>
> What is the solution?
preexec() {
print -Pn "\033k\033\134\033k["${1[1,30]}"]\033\134"
}
Paul.
--
Paul Hoffman <nkuitse@nkuitse.com>
next prev parent reply other threads:[~2013-03-20 20:12 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 [this message]
2013-03-20 20:17 ` Eric Smith
2013-03-20 20:45 ` Paul Hoffman
2013-03-20 20:54 ` Eric Smith
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=20130320194102.GB89285@phisen.local \
--to=nkuitse@nkuitse.com \
--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).