sullyj3 / vim-ftplugin-python

1 stars 4 forks source link

Set omnifunc? #9

Open lgalke opened 6 years ago

lgalke commented 6 years ago

Dear maintainer,

Problem

The omnifunc is overwritten in this ftplugin script. This makes it hard to set a custom omnifunc for python. When specifying autocmd FileType python setlocal omnifunc=foo#bar, the omnifunc gets overwritten. Also, I noticed that the default pythoncomplete#Complete is not shipped with vim (at least not in -python, -python3), which leads to E117: Unknown function: pythoncomplete#Complete upon pressing <C-X><C-O>.

So, when I want to manually set omnifunc for python, I would need to put the customization into after/ftplugin/python.vim?

Possible fixes

Safe set omnifunc

if &omnifunc != ''
  setlocal omnifunc=pythoncomplete#Complete
endif
luffah commented 6 years ago

:+1: with some change on the solution

if &omnifunc == ''
  if has('python') | setlocal omnifunc=pythoncomplete#Complete | endif
  if has('python3') | setlocal omnifunc=python3complete#Complete | endif
endif
sullyj3 commented 6 years ago

Hi guys, I am no longer the maintainer of the python ftplugin. See github.com/tpict/vim-ftplugin-python.

I forgot to update the readme. That's totally my bad, sorry! I'll do that now.