I have these commands in my ~/.vim/ftplugin/markdown.vim:

setlocal spell spelllang=en

When I open a Markdown file, however, 'nospell' is in effect; output of :verbose set spell? shows the "last set" location was my ftplugin, but the values are wrong:

        Last set from ~/.vim/ftplugin/markdown.vim
        Last set from ~/.vim/ftplugin/markdown.vim

Same thing happens if I put the setting in ~/.vim/after/ftplugin/markdown.vim, or in an autocmd:

autocmd FileType markdown setlocal spell spelllang=en

Also happens with :set instead of :setlocal.

I logged messages with :echomsg to prove that the ftplugin was being sourced (it is), and I used :redir inside the ftplugin to show that the settings were correct at the end of the file (also at the end of the "after/ftplugin" file):

redir >> /tmp/log
verbose set spell? spelllang?
redir END

I tried to see what could be overriding it by doing:

:set verbosefile=/tmp/log
:set verbose=20
:e /tmp/some.md

but I can't see anywhere that could be overriding it.

And I tried grepping inside $VIMRUNTIME and ~/.vim to see if I could find any files that might be setting 'spl' or 'spelllang', but there doesn't seem to be anything that could be getting loaded upon accessing a Markdown file that could do this.

Same settings (setlocal in an ftplugin file) work just fine for other filetypes, such as "mail", and in fact this setting used to work just fine for Markdown files too, but at some point it stopped working.

Happens in Vim and Neovim (tested on v8.0 with patches 1-1350, and v0.2.2 respectively).

Any idea how I can get to the bottom of this?

1 Answer 1


I eventually found the answer: an autocmd that ended up calling ownsyntax on.

As the help (:h w:current_syntax) reveals:

Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.