aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'vim/after/ftplugin')
-rw-r--r--vim/after/ftplugin/mail.vim23
-rw-r--r--vim/after/ftplugin/markdown.vim20
-rw-r--r--vim/after/ftplugin/text.vim2
-rw-r--r--vim/after/ftplugin/vim.vim2
4 files changed, 40 insertions, 7 deletions
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index 3ecc0310..d22ec142 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -1,8 +1,29 @@
" Extra configuration for mail messages
-if &filetype !=# 'mail' || v:version < 700
+if &filetype !=# 'mail' || &compatible || v:version < 700
finish
endif
+" We will almost always want to start editing after the headers, so move to
+" the first entirely blank line, if something hasn't already moved us from the
+" start of the file
+if line('.') == 1 && col('.') == 1
+ call search('^$', 'c')
+endif
+
" Add a space to the end of wrapped lines for format-flowed mail
setlocal formatoptions+=w
let b:undo_ftplugin .= '|setlocal formatoptions<'
+
+" Stop here if the user doesn't want ftplugin mappings
+if exists('g:no_plugin_maps') || exists('g:no_mail_maps')
+ finish
+endif
+
+" The quote mapping in the stock plugin is a good idea, but I prefer it to
+" work as a motion rather than quoting to the end of the buffer
+nnoremap <buffer> <expr> <LocalLeader>q mail#Quote()
+nnoremap <buffer> <expr> <LocalLeader>qq mail#Quote().'_'
+xnoremap <buffer> <expr> <LocalLeader>q mail#Quote()
+let b:undo_ftplugin .= '|nunmap <LocalLeader>q'
+ \ . '|nunmap <LocalLeader>qq'
+ \ . '|xunmap <LocalLeader>q'
diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim
index d2cf8918..63f3f062 100644
--- a/vim/after/ftplugin/markdown.vim
+++ b/vim/after/ftplugin/markdown.vim
@@ -3,8 +3,20 @@ if &filetype !=# 'markdown' || v:version < 700
finish
endif
-" Spellcheck documents we're actually editing (not just viewing)
-if &modifiable && !&readonly
- setlocal spell
- let b:undo_ftplugin .= '|setlocal spell<'
+" Spellchecking features
+if has('spell')
+
+ " Spellcheck documents we're actually editing (not just viewing)
+ if &modifiable && !&readonly
+ setlocal spell
+ let b:undo_ftplugin .= '|setlocal spell<'
+ endif
+
+ " Tolerate leading lowercase letters in README.md files, for things like
+ " headings being filenames
+ if expand('%:t') ==# 'README.md'
+ setlocal spellcapcheck=
+ let b:undo_ftplugin .= '|setlocal spellcapcheck<'
+ endif
+
endif
diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim
index 67948706..8341f72d 100644
--- a/vim/after/ftplugin/text.vim
+++ b/vim/after/ftplugin/text.vim
@@ -4,7 +4,7 @@ if &filetype !=# 'text' || v:version < 700
endif
" Spellcheck documents we're actually editing (not just viewing)
-if &modifiable && !&readonly
+if has('spell') && &modifiable && !&readonly
setlocal spell
let b:undo_ftplugin .= '|setlocal spell<'
endif
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
index 2b8ddbb9..ca6b01b0 100644
--- a/vim/after/ftplugin/vim.vim
+++ b/vim/after/ftplugin/vim.vim
@@ -6,7 +6,7 @@ endif
" Use Vint as a syntax checker
compiler vint
let b:undo_ftplugin .= '|unlet b:current_compiler'
- \ . '|setlocal errorformat< makeprg'
+ \ . '|setlocal errorformat< makeprg<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_vim_maps')