On Tue, 26 Jul 2011, niva wrote:

Hi,

Each time that I open a new vimfile of my own or another existing one, the saving action (:w!) takes more and more time after each new saving command.

I suppose it comes from autocommand written in my _vimrc.
Thank you for helping,
Let see:

" Only do this part when compiled with support for autocommands. {{{1
if has("autocmd")
   autocmd bufwritepost ~/_vimrc source $MYVIMRC

If this is in your _vimrc, each time you save your _vimrc, you're doubling the number of times that it gets automatically sourced when saving. I would wrap these in a group, the same way you've wrapped your other vimrcEx commands. Then, the first thing you should do is to delete all commands from that group.

E.g.:

Change:

if has("autocmd")
   autocmd bufwritepost ~/_vimrc source $MYVIMRC
   " other bufwritepost autocmds

To:

if has("autocmd")
   aug AutoReload
      au!
      au bufwritepost ~/_vimrc source $MYVIMRC
      " other bufwritepost autocmds
   aug END

Then, when _vimrc is re-sourced, the first thing it will do is clear out the command that re-sources itself. (So it won't be doubled, just recreated.)

--
Best,
Ben

--
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

Reply via email to