Closed Freed-Wu closed 4 years ago
@aperezdc, now I get such an error whenever I startup neovim:
There is my nvim config, if it's helpful for fixing
it is my error. function coc#source#template#foo() should be declared in autoload/coc/source/template.vim, but after test, i create a new file vim-template.vim. it should rename it to template.vim.
i found coc.nvim has a plugin https://github.com/voldikss/coc-template to realize the same function. amazing.
@fimmind Can https://github.com/aperezdc/vim-template/pull/143 solve your problem?
I'll try it within the day and tell you if it fixed the problem. (Sorry for such a late answer)
it is my pleasure!
I tried #143 and now there is no error message on startup, but completion still doesn't work. I guess that's cause the plugin doesn't provide a way for vim to identify template files (e.g. echo &ft
for =template=.py
shows python
, and completion works the same way as for any other Python file). I also tried adding
autocmd BufEnter =template=* setlocal ft=template
autocmd BufEnter .vim-template:* setlocal ft=template
into ftdetect/template.vim
, but this didn't help
I figured out that I used a wrong filetype. Now I added following into ftdetect/vim-template.vim
and everything works very well:
autocmd BufEnter =template=* setlocal ft=vim-template
autocmd BufEnter .vim-template:* setlocal ft=vim-template
But I looked at vim-template
's source code and found out that there are lines of code attempting to set filetype similarly to how I did this, but somewhy they have no effect. Do you know why could this happen?
perhaps you use lazy load function fo plugin manager? i think if can move these code to ftdetect/filetype.vim will be better if it can. https://github.com/aperezdc/vim-template/issues/139
just like lsp, when user write a language will auto prompt the keyword of this language?