On Tue, Apr 7, 2009 at 12:33 PM, Henry Bush wrote:
>
> I want to save the title of the konsole window when i enter vim, then
> return it back afterwards. The code in my .vimrc atm looks like:
>
> let $ORIGKONSOLETITLE = system("dcop $KONSOLE_DCOP_SESSION sessionName")
No idea if there's more to your problem than this, but this might be
all... when calling system commands in vim (unlike in shell, for
example), you'll get a trailing newline if the applications output
ended in a trailing newline... so, a fairly common idiom is to get rid
of those with
:let var = system("somecommand | tr -d '\n')
> autocmd BufReadPost * :silent !dcop $KONSOLE_DCOP_SESSION renameSession %
> autocmd VimLeave * :!dcop $KONSOLE_DCOP_SESSION renameSession
> $ORIGKONSOLETITLE
>
> But my title doesn't get changed on exit. Bizarrely, if I swap
> $ORIGKONSOLETITLE for $PWD it works.
>
> Does anyone have any clue what might be going on here? The only
> difference between variables seems to be whitespace at the end (which
> I don't seem to be able to get rid of, at least by putting a sed at
> the end of the command on the "let" line).
The problem could very well be that dcop can't handle the trailing
newline in its input...
> All suggestions gratefully received :-)
~Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---