I am trying to load plugins based on file type. I have the following in ftplugin/python.vim:
When a python file is opened, not folding is done. If I issue the same command from the python buffer :packadd SimpylFold, no effect either, but if 'packadd SimpylFold' is added to vimrc, folding works fine. By experementing I found that adding the following two lines from plugin/SimpylFold.vim to ftplugin/python.vim does the trick:
packadd SimpylFold \ | call SimpylFold#BufferInit() \ | setlocal foldexpr=SimpylFold#FoldExpr(v:lnum)
My questions are:
Why running 'packadd SimpylFold' from the current buffer of including in ftplugin do not work the same way as including it in vimrc?
Why adding the following to ftplugin has no effect either?
let b:SimpylFold_docstring_preview = 1