On Dec 4, 6:58 am, Tony Mechelynck <[email protected]> wrote: > The precautions in question include > - defining functions, autocommands and commands with a bang to remove > any existing versions > - explicit :unlet, :unmap etc. to remove anything present in the old > version and removed in the new one; then wrapping them in if exists(), > if hasmapto(), or alternately in try... catch... [finally...] endtry, to > avoid errors when it's not necessary anymore.
While this may be technically correct, I've found that only the first is necessary for most situations. I also always use this format when defining autocmds, as suggested in the :help: augroup spam au! autocmd BufEnter * Eggs augroup END Note the au!, which clears out any existing autocmds in the current group (defined by the augroup command above), so that when re-sourcing your .vimrc you only get one set of autocmds. Of course, if Vim starts acting unexpectedly after doing a :source $MYVIMRC then you can always exit Vim and come back into it. I have also found that splitting your .vimrc into several files (for example, I have one file for my guitablabel setup, another for misc. commands and mappings, another for autocmds/abbreviations that automatically insert text at various places, etc.), and then just putting :source commands in your .vimrc, will dimish the likelihood of screwing up anything since you only need to reload a small part of your config most of the time. -- You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php
