Friday, February 26, 2016

Re: How to write autocmd command to set local variable to some value when new buffer is created?

On Friday, February 26, 2016 at 1:19:35 AM UTC-6, Igor Forca wrote:
> The only work-around I have found now is to replace "BufNew" with "BufEnter" in autocmd command inside $MYVIMRC file, restarted gVim and then it works fine.
> It is still mistery to me why BufNew does not have effect in my case and BufEnter has. Any idea how to debug?
>

Yes. You've already pretty much ruled out your .vimrc, so next check if the problem is in your plugins by starting Vim with:

gvim -N -u NONE -i NONE

(technically this turns off both your plugins and your .vimrc, plus it sets nocompatible mode)

Then, enter your autocmds, and the one plugin you may need. I assume your problem will go away. The usual advice after that would be to enable half your plugins and do a "binary search" for the offending plugin.

But if you don't have very many, it may be faster do debug directly. Instead of :enew do :debug enew

Then enter 's' (step) and/or 'n' (next) until you see where the heck your commenstring gets overwritten. Then go zap that line.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment