[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: query current window title to stdout?
From: |
Michael Parson |
Subject: |
Re: query current window title to stdout? |
Date: |
Fri, 15 Aug 2008 16:01:23 -0500 |
On Aug 15, 2008, at 11:42 AM, Michael Parson wrote:
I've got a user that wants to be able to, with a single command,
rename the title for the current window when he edits a file to the
name of the file he is editing.
<snip>
Can this be done? or is the solution I've come up with going to be
about as good as it gets?
working with a friend, we came up with this:
_svim () {
/usr/bin/screen -X msgwait 5
echo -ne "\ekediting $1\e\\"
/usr/bin/vim $1
exit
}
svim () {
tname=`basename $(mktemp -u)`
/usr/bin/screen -t $tname
/usr/bin/screen -X msgwait 0
/usr/bin/screen -X at "$tname" stuff "_svim $1^M"
}
Which lets me do fun things like:
for ij in foo1.pl foo2.pl foo3.pl do; svim $ij; done
And have 3 new windows pop open with the new files in them, window
titles set appropriately, should be race-condition safe.
This is all on a Linux box, using bash, and has the gnu mktemp
installed. Other systems will have to be modified as needed.
--
Michael Parson
address@hidden