aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/mail.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-23 01:26:12 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-23 01:26:12 +1200
commit87f5f379d52ffa0a4fb8662788fc28a4a5028dc3 (patch)
tree3d606b1c105a91e7204eed0cddd9ed03f08f9f52 /vim/after/ftplugin/mail.vim
parentMerge branch 'release/v6.37.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-2611eef3a83ff42529e287027cf6e064c7ab9adf.tar.gz (sig)
dotfiles-2611eef3a83ff42529e287027cf6e064c7ab9adf.zip
Merge branch 'release/v6.38.0'v6.38.0
* release/v6.38.0: Update paste_insert.vim to v0.3.0 Use tr() over substitute() for character swap Fix up some pattern qualifiers Update digraph_search.vim to v1.1.0 Correct indent settings Don't squeeze blanks by default in mail filetype Improve honesty of comment in mail ftplugin Move mail ftplugin function out into autoload Add local maps for normalising mail quotes Don't do :StrictQuote automatically on mail edit Make :StrictQuote command accept a range
Diffstat (limited to 'vim/after/ftplugin/mail.vim')
-rw-r--r--vim/after/ftplugin/mail.vim49
1 files changed, 7 insertions, 42 deletions
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index f4a4c91d..9f8fc608 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -3,8 +3,7 @@
let b:quote_space = 0
let b:undo_ftplugin .= '|unlet b:quote_space'
-" If something hasn't already moved the cursor, we'll move to an optimal point
-" to start writing
+" Attempt to move to a good spot to start writing
function! s:SuggestStart() abort
" Move to top of buffer
@@ -49,38 +48,13 @@ let b:undo_ftplugin .= '|delcommand SuggestStart'
SuggestStart
" Normalise quoting
-function! s:StrictQuote() abort
- let body = 0
- for lnum in range(1, line('$'))
-
- " Get current line
- let line = getline(lnum)
-
- " Skip lines until we hit a blank line, meaning body text
- let body = body || !strlen(line)
- if !body
- continue
- endif
-
- " Get the leading quote string, if any; skip if there isn't one
- let quote = matchstr(line, '^>[> ]*')
- if !strlen(quote)
- continue
- endif
-
- " Normalise the quote with no spaces
- let quote = substitute(quote, '[^>]', '', 'g')
-
- " Re-set the line
- let line = substitute(line, '^[> ]\+', quote, '')
- call setline(lnum, line)
-
- endfor
-endfunction
-command -bar -buffer StrictQuote
- \ call s:StrictQuote()
+command -buffer -bar -range=% StrictQuote
+ \ call mail#StrictQuote(<q-line1>, <q-line2>)
+nnoremap <LocalLeader>s
+ \ :StrictQuote<CR>
+xnoremap <LocalLeader>s
+ \ :StrictQuote<CR>
let b:undo_ftplugin .= '|delcommand StrictQuote'
-StrictQuote
" Add a space to the end of wrapped lines for format-flowed mail
setlocal formatoptions+=w
@@ -88,17 +62,8 @@ let b:undo_ftplugin .= '|setlocal formatoptions<'
" Mail-specific handling for custom vim-squeeze-repeat-blanks plugin
if exists('loaded_squeeze_repeat_blanks')
-
- " Set the blank line pattern
let b:squeeze_repeat_blanks_blank = '^[ >]*$'
let b:undo_ftplugin .= '|unlet b:squeeze_repeat_blanks_blank'
-
- " If there is anything quoted in this message (i.e. it looks like a reply),
- " squeeze blanks, but don't report lines deleted
- if search('\m^>', 'cnw')
- silent SqueezeRepeatBlanks
- endif
-
endif
" Spellcheck documents we're actually editing (not just viewing)