Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to set the icon of vim terminals that I run by writing a small line in my .vimrc:

execute '!xseticon -id \"' . v:windowid . '\" /usr/share/icons/Faenza/apps/16/vim.png'

However, I can't get it to properly work. The strings are concatenating and all, however I get the error:

xseticon: error: Invalid window id format: "0".

which I think is because it is running the script before vim can properly grab window ids, perhaps because it is not yet running.

How can I work around or solve this?

share|improve this question

migrated from stackoverflow.com Nov 16 '12 at 11:51

This question came from our site for professional and enthusiast programmers.

up vote 4 down vote accepted

You're right, when .vimrc is executed, the window hasn't yet been created. You can use the VimEnter event for that:

:autocmd VimEnter * execute ...
share|improve this answer
    
Perfect! I didn't have to escape my " characters in the working line. Now I just have to make it reset the icon on close ... but I think you got me on the right track and I can figure that out now. – ndt Nov 16 '12 at 14:31
1  
Great; glad I could help. For closing, there's the VimLeave event. – Ingo Karkat Nov 16 '12 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .