From 080d0352f34f918b5a96d95798011fb57c49a68f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 2 Jul 2018 11:47:26 +1200 Subject: Don't spellcheck &readonly text/markdown This stops annoying highlighting when I'm just reading something in Vim, rather than editing it (e.g. `view` or an unwriteable file). --- vim/after/ftplugin/markdown.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'vim/after/ftplugin/markdown.vim') diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index 29d13c71..7ec37c64 100644 --- a/vim/after/ftplugin/markdown.vim +++ b/vim/after/ftplugin/markdown.vim @@ -12,7 +12,9 @@ let b:did_ftplugin_after = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_after' -" Spellcheck documents -setlocal spell -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal spell<' +" Spellcheck documents we're actually editing (not just viewing) +if !&readonly + setlocal spell + let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal spell<' +endif -- cgit v1.2.3