[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: query current window title to stdout?
From: |
Christian Ebert |
Subject: |
Re: query current window title to stdout? |
Date: |
Fri, 15 Aug 2008 23:50:46 +0200 |
User-agent: |
Mutt/1.5.18 (2008-07-10) |
* Michael Parson on Friday, August 15, 2008 at 11:42:35 -0500
> 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.
>
> What I've come up with is a bash function:
>
> svim () {
> echo -ne "\ekediting $1 \e\\"
> /usr/local/bin/vim $1
> echo -ne "\ekbash\e\\"
> }
>
> What I would like to be able to do, is query the title of the window
> before we rename it, so we can set it back to what it was after the
> editor quits. something like:
>
> oldname=`screen -X windowname`
>
> So I could change that last echo to be more like
>
> echo -ne "\ek$oldname\e\\"
>
> However, it seems that just about every screen command only spit output
> to the status bar, hardline, or a new screen, except 'screen -l'.
>
> Can this be done? or is the solution I've come up with going to be about
> as good as it gets?
If it's for vim, it can be (almost) done. I have the follwoing in
.vimrc:
if &term =~ '^screen'
set title
" VimTip #1126
set t_ts=^[k
set t_fs=^[\
let &titleold = fnamemodify(&shell, ":t")
endif
The "^[" is entered Ctrl-V [
c
--
Vim plugin to paste current GNU Screen buffer in (almost) any mode:
<http://www.vim.org/scripts/script.php?script_id=1512>