I had "!" on the functions, but not on the commands. Adding the latter removed the errors.
Regarding per-buffer function definitions: Can anyone point me to the applicable part of the docs describing how to specify this option? Didn't see anything applicable with :help command or :help function. Thanks, Sam _______________________ Samuel Huckins Homepage - http://samuelhuckins.com Tech blog - http://dancingpenguinsoflight.com/ Photos - http://www.flickr.com/photos/samuelhuckins/ Twitter - http://twitter.com/shuckins AIM - samushack | Gtalk - samushack | Skype - shuckins ________________________________ From: Ben Fritz <[email protected]> To: vim_use <[email protected]> Sent: Monday, July 13, 2009 10:37:22 PM Subject: Re: Errors from commands being imported more than once when opening multiple files On Jul 13, 7:30 pm, wormwood_3 <[email protected]> wrote: > Greetings noble vim users! > > In .vim/ftplugin/python.vim, I have a number of Python related > configurations... > > command Pyflakes :call Pyflakes() > function! Pyflakes() > ... > endfunction > > The problem is that when I call vim opening multiple Python files, as soon as > the first is opened and the others start to open I get errors like: > > Error detected while processing /home/sam/.vim/ftplugin/python.vim: > line 24: > E174: Command already exists: add ! to replace it > line 31: > E122: Function Pyflakes already exists, add ! to replace it > line 33: > > ... > So it seems that all the applicable config is loaded per file sent to vim, > and after the first is loaded the above functions are already in place. Is > there a different way to define custom commands to get around this issue? It > doesn't affect the functionality, it's just an annoyance to wait for the > errors to disappear, especially when opening a number of files. And I'm also > wondering if I'm doing something wrong. > The easiest way, for functions, would be to define them with a ! as you show in your example. Are you sure the ! occurs in all the functions in your file? For commands, you could do the same (use command! instead of command) or you can pass it the "-buffer" argument to only define the command on a per-buffer basis. The latter is probably better anyway, as you don't need to be able to use the command in an xml file you open, for example. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
