masukomi / vim-markdown-folding

Fold markdown documents by section.
250 stars 43 forks source link

E184: No such user-defined command: FoldToggle #28

Closed sedm0784 closed 5 years ago

sedm0784 commented 6 years ago

I'm getting the following error when I open a markdown file:

Error detected while processing function <SNR>11_LoadFTPlugin:
line    4:
E184: No such user-defined command: FoldToggle 

I can reproduce the error reliably with my standard configuration, but the circumstances in which it occurs seem to be complicated: it occurs when a BufRead autocommand opens and modifies the contents of a scratch window, but so far I haven't managed to create a smaller test config that still displays the bug. Also, weirdly, the error first appeared immediately after I moved all my plugins from /bundle into /pack/bundle/start (with no other changes made).

Having done some debugging, I can see that shortly before the error is displayed, the value for b:undo_ftplugin is set incorrectly—note the repetition of the final line, which is the immediate cause of the error:

setlocal commentstring< matchpairs< omnifunc< comments< formatoptions<
| unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter
|setl cms< com< fo< flp< 
| setlocal foldmethod< foldtext< foldexpr< | delcommand FoldToggle  
| setlocal foldmethod< foldtext< foldexpr< | delcommand FoldToggle

(linebreaks added for clarity)

This issue is therefore related to issue 15. Fixing that by replacing .= with = as you suggest would also fix this, but the root cause would still be unknown, and you'd also be blowing away the existing value, which may not be desired.

masukomi commented 5 years ago

@sedm0784 & @meatcar I've merged in a number of community changes and I'm not seeing this anymore.

Can you update your copy and let me know if you're having this problem still?

Please note that the repo has changed owners. Github should redirect any requests to the old url but, just in case you should probably change nelstrom/vim-markdown-folding to masukomi/vim-markdown-folding in your plugin manager to make sure everything keeps working going forwards.

For now I'm closing this issue because I believe it to be fixed. Please reopen if you are still experiencing it.