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