Monday, July 16, 2012

Re: how to override system ftplugin settings with user custom ?

On 7/8/2012 2:57 AM, Gary Johnson wrote:
> On 2012-07-08, chris wrote:
>>
>> I set one option omnifunc in `~/.vim/ftplugin/python/python.vim` like this:
>> setlocal omnifunc=3Dpython3complete#Complete
>> But this can not work.
>> When I open a python file. I checked omnifunc setting with command:
>> `:verbose set omnifunc?`
>> I get output:
>> omnifunc=3Dpythoncomplete
>> Last set /usr/share/vim/vim73/ftplugin/python.vim
>>
>> I want to override the system omnifunc setting with my own setting:
>> setlocal omnifunc=3Dpython3complete#Complete
>>
>> Does anybody know why my custom option can not work ?
>
> Vim sources plugins in the order determined by 'runtimepath',
> typically
>
> ~/.vim
> /usr/local/share/vim/vimfiles
> /usr/local/share/vim/vim73
> /usr/local/share/vim/vimfiles/after
> ~/.vim/after
>
> so anything you set in ~/.vim/ftplugin/python/python.vim may be
> overwritten in /usr/local/share/vim/vim73/ftplugin/python.vim. You
> can add code to your plugin to prevent the contents of Vim's plugin
> from being executed, but that isn't what you want to do here.
> Instead, you should put your option setting in
> ~/.vim/after/python.vim or ~/.vim/after/python/python.vim so that
> yours is set after Vim's.
>
> Regards,
> Gary
>


help usr_41.txt

41.12 Writing a filetype plugin

"
If you do want to use the default plugin, but overrule one of the
settings,
you can write the different setting in a script: >

setlocal textwidth=70

Now write this in the "after" directory, so that it gets sourced after the
distributed "vim.vim" ftplugin after-directory. For Unix this would be
"~/.vim/after/ftplugin/vim.vim".
"

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

No comments:

Post a Comment