Sunday, July 8, 2012

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

On 08/07/12 08:48, Christian Brabandt wrote:
> Hi chris!
>
> On So, 08 Jul 2012, 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
>
> http://vimhelp.appspot.com/vim_faq.txt.html#faq-26.3
>
> regards,
> Christian
>

There is an error in that FAQ:

- There is no $VIMRTUNTIME directory (with T after the R), it is
$VIMRUNTIME, and in addition you should *never* modify its contents or
that of any of its subdirectories at any depth, because any update of
Vim (next week, or three years from now) may override your changes with
no warning.

You should use one of the following:

- for small changes to be done after (and in addition to) what is
already done by the plugin installed with Vim, use an after-directory,
as follows (replacing foobar by the 'filetype' of the concerned files):

- for changes private to one user (one login name):
- on Windows:
$HOME/vimfiles/after/ftplugin/foobar.vim
- on Unix-like OSes:
$HOME/.vim/after/ftplugin/foobar.vim
- for changes affecting all users on the system (on any OS):
$VIM/vimfiles/after/ftplugin/foobar.vim

- when replacing the whole filetype-plugin by a different version, or
when installing a new ftplugin for some filetype not yet supported by
Vim out of the box: use the same paths without the after/ in them. In
that case you should place near the start of your plugin an "if...
finish... endif... let" block like the one in the plugins distributed
with Vim.

All the above paths are given in Vim terminology (which is similar to
Unix terminology, but is understood even by Vim for Windows); they don't
exist by default, so the first time you need them you will have to
create them using mkdir (on any OS including DOS/Windows) or md (on
DOS/Windows only). $VIM and, on DOS/Windows, $HOME, do not necessarily
exist outside Vim. If $HOME has no value (or no valid value) inside Vim,
you can use $VIM instead; but on any but possibly very old versions of
Windows, $HOMEDRIVE and $HOMEPATH are defined by the system, and if
$HOME is undefined at Vim startup, Vim will set it by expanding
$HOMEDRIVE$HOMEPATH before sourcing your vimrc. To know which values Vim
uses, you can type (in a running Vim):

:echo $VIM
:echo $HOME


Best regards,
Tony.
--
Children aren't happy without something to ignore,
And that's what parents were created for.
-- Ogden Nash

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