7

I am running windows with gVim version 7.3-46 (32bit)

I have set up Vim to automatically source my .vimrc after saving it with

if has("autocmd")  
 autocmd bufwritepost vimrc.win source $MYVIMRC "Source config file on save  
endif

But when I issue the :w command my Powerline loses its color (it gets sourced indeed but breaks something). After reloading the file manually via :source $MYVIMRC the color returns. --> MYVIMRC

enter image description here

Sensei
  • 598
  • 1
  • 4
  • 13
  • I can't tell you what causes that behaviour, but I'd just try to set the path to your ```.vimrc``` within the ```autocmd``` as a test to see if it makes any difference. – Saucier May 12 '13 at 21:56
  • I set the second argument to the absolut path, problem persists. I have a sym linked vimrc. But this shouldn't be a problem right? – Sensei May 12 '13 at 22:45

1 Answers1

2

Duplicate of issue 213. When resourcing vimrc always use autocmd-nested.

ZyX
  • 52,536
  • 7
  • 114
  • 135
  • 1
    Thank, now it works perfectly. Otommod talks about another solution (https://github.com/fatih/subvim/pull/13#issuecomment-16436263) which doesn't work for me. Maybe it helps someone esle. TL:DR: add `au BufWritePost .vimrc PowerlineReloadColorscheme` to your config (not the solution ZyX talked about, go read his link) – Sensei May 13 '13 at 10:52
  • @Sensei AFAIK this is the solution for deprecated vim-powerline. AFAIR it had the same bug when issuing `:colorscheme`, but I don’t remember whether or not it was fixed. In new powerline it fixes it by hooking `Colorscheme` event thus `nested` is required to make this event launch. – ZyX May 14 '13 at 04:04
  • I'm still using `vim-powerline` instead of the new `powerline` though. Mainly because its "only" beta (never touch a running system ;-P) – Sensei May 14 '13 at 06:38
  • @Sensei `vim-powerline` was a beta too. Now it is a deprecated beta. – ZyX May 15 '13 at 17:04
  • Lokaltog is very smart, he disguised this with the greek letter so it wouldn't catch your eye immediately ;-D Just kidding. Never noticed it though. – Sensei May 15 '13 at 17:17