Is there a way to set (and have vim remember) settings that are specific to an individual file? Specifically, I would like to turn spell checking on or off for specific files and have vim remember that setting for each.
In my particular case, I maintain a fairly large set of note pages written in markdown. All of these files end in the .md
suffix. Some of these files predominantly contain text and others contain mostly code and/or large and unwieldy URLs. I'd like vim to remember which files have spell checking turned on and which have it turned off. As it stands, they all have spell checking turned on by default, and I need to manually turn it off for individual files after opening them.
Is this possible when using either vim or gvim?
after/ftplugin/markdown.vim
to set spell or nospell depending on the contents of the file? For example, since you don't want to have spellcheck on when there are URLs in your markdown files, thenif search("https://") != 0 | set nospell | endif
. Alternatively, you can check whether there are common tokens in your markdown notes that indicate such files should have spellcheck enabled. Or count the number of URLs in a given file and if this is a large number, set nospell.