Deoplete.nvim: Unknown function: deoplete#custom#source

Created on 23 May 2018  路  5Comments  路  Source: Shougo/deoplete.nvim

Problems summary

I am using the example configuration linked in the readme: https://gist.github.com/afnanenayet/8c2ee0fdabb8d1e292b788f9723673c5

It appears this was removed, but cannot find the replacement: https://github.com/Shougo/deoplete.nvim/blob/master/doc/deoplete.txt#L1664

When I open nvim, I get this error:

Unknown function: deoplete#custom#source.

Expected

For the configuration to work.

Environment Information

  • deoplete version(SHA1):
    165e693cbb1198569954b2a01f7ba56026bf7ddf

  • OS:

macOS

  • neovim/Vim :version output:

NVIM v0.2.2

  • :checkhealth or :CheckHealth result(neovim only):

health#deoplete#check

deoplete.nvim

  • OK: has("nvim") was successful
  • OK: exists("v:t_list") was successful
  • OK: has("timers") was successful
  • OK: has("python3") was successful
  • INFO: If you're still having problems, try the following commands:
    $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    $ nvim
    $ cat /tmp/log_{PID}
    and then create an issue on github

health#LanguageClient#check

  • OK: binary found: /Users/t/.config/nvim/plugged/LanguageClient-neovim/bin/languageclient
  • OK: languageclient 0.1.80 61ce058582a4bb366dd4f735e25e1a355507080f

health#nvim#check

Configuration

  • OK: no issues found

Performance

  • OK: Build type: Release

Remote Plugins

  • OK: Up to date

terminal

  • INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  • INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  • INFO: $XTERM_VERSION=''
  • INFO: $VTE_VERSION=''
  • INFO: $TERM_PROGRAM=''
  • INFO: $SSH_TTY=''

health#provider#check

Clipboard (optional)

  • OK: Clipboard tool found: pbcopy

Python 2 provider (optional)

  • WARNING: No Python interpreter was found with the neovim module. Using the first available for diagnostics.
  • WARNING: provider/pythonx: Could not load Python 2:
    /usr/local/bin/python2 does not have the "neovim" module. :help |provider-python|
    /usr/local/bin/python2.7 does not have the "neovim" module. :help |provider-python|
    python2.6 not found in search path or not executable.
    /usr/local/bin/python does not have the "neovim" module. :help |provider-python|
  • ERROR: Python provider error

    • ADVICE:



      • provider/pythonx: Could not load Python 2:


        /usr/local/bin/python2 does not have the "neovim" module. :help |provider-python|


        /usr/local/bin/python2.7 does not have the "neovim" module. :help |provider-python|


        python2.6 not found in search path or not executable.


        /usr/local/bin/python does not have the "neovim" module. :help |provider-python|



  • INFO: Executable: Not found

Python 3 provider (optional)

  • INFO: g:python3_host_prog is not set. Searching for python3 in the environment.
  • INFO: Executable: /usr/local/bin/python3
  • INFO: Python3 version: 3.6.5
  • INFO: python3-neovim version: 0.2.6
  • OK: Latest python3-neovim is installed: 0.2.6

Ruby provider (optional)

  • INFO: Ruby: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
  • WARNING: Missing "neovim" gem.

    • ADVICE:



      • Run in shell: gem install neovim


      • Is the gem bin directory in $PATH? Check gem environment.


      • If you are using rvm/rbenv/chruby, try "rehashing".



Node provider (optional)

  • INFO: Node: v9.2.0
  • WARNING: Missing "neovim" npm package.

    • ADVICE:



      • Run in shell: npm install -g neovim


      • Is the npm bin directory in $PATH?



Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

https://gist.github.com/afnanenayet/8c2ee0fdabb8d1e292b788f9723673c5

The reproduce ways from neovim/Vim starting (Required!)

  1. Open nvim using the configuration.

Screen shot (if possible)

https://cl.ly/rlCH

invalid

Most helpful comment

Stumbled over this problem too, and I figured I might give a slightly better answer than the current one.

As already mentioned, this isn't a deoplete issue - it's a config issue. It's not specific to this plugin either; it can be triggered by different plugins, and it depends on your .vimrc.

I personally found it extremely weird, because I only got that error on boot. All my testing used source ~/.vimrc, but any hard reset triggered the error. Sourcing after the error actually fixed any issues caused my the statements not being called. I had the problem with another plugin as well (functions not found in spite of them existing, verified at runtime with sourcing as well as copy-pasting the line into a :call statement.

This is more of an issue with how these scripts manage the runtime path. It's described here - some (if not all, I'm honestly not sure) plugin managers don't add it instantly after the load command. The end command modifies the runtime path.

So yeah, the plugin isn't loaded yet.

There's basically two options. As I mentioned, the plugins aren't necessarily loaded after the actual line that defines the plugin use - it's loaded later.

The first option, as outlined in the answer, autocmd:

autocmd VimEnter * call deoplete#custom#source('_',  'disabled_syntaxes', ['Comment', 'String'])

Once it enters, it should be loaded by most plugin managers.

Alternatively, move the config after the end statement for whatever plugin manager you use:

...

Plug 'Shougo/deoplete.nvim'
call plug#end() " Or some other function

call deoplete#custom#source('_', 'disabled_syntaxes', ['Comment', 'String'])

I only tested this with Plug, but I imagine it should apply to the rest as well. Removed the errors for me anyway (LanguageServer integration).

TL;DR: use autocmd to delay the execution, or call it after the runtime path is set (with a plugin manager: after the end call)

All 5 comments

Your configuration is invalid.
Because it does not work.

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

You have not read the sentense. The init.vim must be executable like this.

$ nvim -u your_minimal_init.vim

I will close the issue.

Hint:

I think you does not load deoplete.nvim.
You need to set runtimepath before calling call deoplete#custom#source().

You should learn about Vim script.

" Your minimal init.vim/vimrc
set runtimepath+=~/path/to/deoplete.nvim/
let g:deoplete#enable_at_startup = 1

Stumbled over this problem too, and I figured I might give a slightly better answer than the current one.

As already mentioned, this isn't a deoplete issue - it's a config issue. It's not specific to this plugin either; it can be triggered by different plugins, and it depends on your .vimrc.

I personally found it extremely weird, because I only got that error on boot. All my testing used source ~/.vimrc, but any hard reset triggered the error. Sourcing after the error actually fixed any issues caused my the statements not being called. I had the problem with another plugin as well (functions not found in spite of them existing, verified at runtime with sourcing as well as copy-pasting the line into a :call statement.

This is more of an issue with how these scripts manage the runtime path. It's described here - some (if not all, I'm honestly not sure) plugin managers don't add it instantly after the load command. The end command modifies the runtime path.

So yeah, the plugin isn't loaded yet.

There's basically two options. As I mentioned, the plugins aren't necessarily loaded after the actual line that defines the plugin use - it's loaded later.

The first option, as outlined in the answer, autocmd:

autocmd VimEnter * call deoplete#custom#source('_',  'disabled_syntaxes', ['Comment', 'String'])

Once it enters, it should be loaded by most plugin managers.

Alternatively, move the config after the end statement for whatever plugin manager you use:

...

Plug 'Shougo/deoplete.nvim'
call plug#end() " Or some other function

call deoplete#custom#source('_', 'disabled_syntaxes', ['Comment', 'String'])

I only tested this with Plug, but I imagine it should apply to the rest as well. Removed the errors for me anyway (LanguageServer integration).

TL;DR: use autocmd to delay the execution, or call it after the runtime path is set (with a plugin manager: after the end call)

You must call deoplete#custom#source() after plug#end().
Because, plug#end() add plugins runtimepath.

It is vim-plug's feature.

Was this page helpful?
0 / 5 - 0 ratings