aboutsummaryrefslogtreecommitdiff
path: root/vim/after
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-02 11:47:26 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-02 11:47:26 +1200
commit080d0352f34f918b5a96d95798011fb57c49a68f (patch)
treef204507450280ae0c8c33907756632c8e0b88c81 /vim/after
parentAdd 'c' flag to 'formatoptions' for gitcommit (diff)
downloaddotfiles-080d0352f34f918b5a96d95798011fb57c49a68f.tar.gz
dotfiles-080d0352f34f918b5a96d95798011fb57c49a68f.zip
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).
Diffstat (limited to 'vim/after')
-rw-r--r--vim/after/ftplugin/markdown.vim10
-rw-r--r--vim/after/ftplugin/text.vim10
2 files changed, 12 insertions, 8 deletions
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
diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim
index cd35231e..06ca464a 100644
--- a/vim/after/ftplugin/text.vim
+++ b/vim/after/ftplugin/text.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