aboutsummaryrefslogtreecommitdiff
path: root/vim/ftplugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-07 11:43:02 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-07 11:49:39 +1300
commit09b83b6e25431fe9f3122916156f97fb0cfc2b5b (patch)
treecb5b2a92706eaa099c193095983cc0086efa6f29 /vim/ftplugin
parentUpdate <Leader>b mapping to use new mapping name (diff)
downloaddotfiles-09b83b6e25431fe9f3122916156f97fb0cfc2b5b.tar.gz
dotfiles-09b83b6e25431fe9f3122916156f97fb0cfc2b5b.zip
Use b:undo variables correctly
Setting or adding to b:undo_indent and b:undo_ftplugin variables, which I only learned about just now, allows me to avoid the _GLOBAL.vim hack and remove some files from both vim/indent/ and vim/ftplugin/. These variables aren't subjected to :execute automatically in anything older than Vim 7.0, but I don't think that's too much of a concern as the only real reason they're needed are for changing filetypes in the same buffer, which doesn't happen that often anyway.
Diffstat (limited to 'vim/ftplugin')
-rw-r--r--vim/ftplugin/mail.vim7
-rw-r--r--vim/ftplugin/markdown.vim11
-rw-r--r--vim/ftplugin/sh.vim7
-rw-r--r--vim/ftplugin/text.vim11
4 files changed, 36 insertions, 0 deletions
diff --git a/vim/ftplugin/mail.vim b/vim/ftplugin/mail.vim
index 35432b96..236f25ff 100644
--- a/vim/ftplugin/mail.vim
+++ b/vim/ftplugin/mail.vim
@@ -1,2 +1,9 @@
" Use trailing whitespace to denote continued paragraph
setlocal formatoptions+=w
+
+" Undo
+if !exists('b:undo_ftplugin')
+ let b:undo_ftplugin = ''
+endif
+let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|setlocal formatoptions<'
diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim
new file mode 100644
index 00000000..15333202
--- /dev/null
+++ b/vim/ftplugin/markdown.vim
@@ -0,0 +1,11 @@
+" Spellcheck documents by default
+if has('syntax')
+ setlocal spell
+
+ " Undo
+ if !exists('b:undo_ftplugin')
+ let b:undo_ftplugin = ''
+ endif
+ let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|setlocal spell<'
+endif
diff --git a/vim/ftplugin/sh.vim b/vim/ftplugin/sh.vim
index 8990f0fa..85251aa1 100644
--- a/vim/ftplugin/sh.vim
+++ b/vim/ftplugin/sh.vim
@@ -48,3 +48,10 @@ endif
nnoremap <buffer> <silent>
\ <LocalLeader>l
\ :<C-U>execute b:lint<CR>
+
+" Undo
+if !exists('b:undo_ftplugin')
+ let b:undo_ftplugin = ''
+endif
+let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|setlocal keywordprg<'
diff --git a/vim/ftplugin/text.vim b/vim/ftplugin/text.vim
new file mode 100644
index 00000000..15333202
--- /dev/null
+++ b/vim/ftplugin/text.vim
@@ -0,0 +1,11 @@
+" Spellcheck documents by default
+if has('syntax')
+ setlocal spell
+
+ " Undo
+ if !exists('b:undo_ftplugin')
+ let b:undo_ftplugin = ''
+ endif
+ let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|setlocal spell<'
+endif