diff options
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 49 | ||||
-rw-r--r-- | vim/after/indent/c.vim | 14 | ||||
-rw-r--r-- | vim/after/indent/gitconfig.vim | 12 | ||||
-rw-r--r-- | vim/after/indent/make.vim | 18 | ||||
-rw-r--r-- | vim/autoload/html.vim | 6 | ||||
-rw-r--r-- | vim/autoload/mail.vim | 23 | ||||
-rw-r--r-- | vim/autoload/spellfile_local.vim | 2 | ||||
m--------- | vim/bundle/digraph_search | 0 | ||||
m--------- | vim/bundle/paste_insert | 0 | ||||
-rw-r--r-- | vim/indent/csv.vim | 10 | ||||
-rw-r--r-- | vim/indent/help.vim | 16 |
12 files changed, 88 insertions, 66 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v6.37.0 -Sat, 22 Jun 2019 06:28:10 +0000 +tejr dotfiles v6.38.0 +Sat, 22 Jun 2019 13:26:12 +0000 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) diff --git a/vim/after/indent/c.vim b/vim/after/indent/c.vim index ad01aceb..9cea0a2d 100644 --- a/vim/after/indent/c.vim +++ b/vim/after/indent/c.vim @@ -1,9 +1,15 @@ -" Use hard tabs for C +" Use plain old tabs for indent in C files setlocal noexpandtab -setlocal shiftwidth=0 -let b:undo_indent .= '|setlocal expandtab< shiftwidth<' +let b:undo_indent .= '|setlocal expandtab<' +if v:version > 703 + \ || v:version == 703 && has('patch629') + setlocal shiftwidth=0 +else + let &l:shiftwidth = &l:tabstop +endif +let b:undo_indent .= '|setlocal shiftwidth<' if &softtabstop != -1 - let &softtabstop = &shiftwidth + let &l:softtabstop = &l:shiftwidth let b:undo_indent .= '|setlocal softtabstop<' endif diff --git a/vim/after/indent/gitconfig.vim b/vim/after/indent/gitconfig.vim index ff1654e5..943e78ea 100644 --- a/vim/after/indent/gitconfig.vim +++ b/vim/after/indent/gitconfig.vim @@ -1,9 +1,15 @@ " Use tabs for indent in Git config files, rather than fighting with the " frontend tool setlocal noexpandtab -setlocal shiftwidth=0 -let b:undo_indent .= '|setlocal expandtab< shiftwidth<' +let b:undo_indent .= '|setlocal expandtab<' +if v:version > 703 + \ || v:version == 703 && has('patch629') + setlocal shiftwidth=0 +else + let &l:shiftwidth = &l:tabstop +endif +let b:undo_indent .= '|setlocal shiftwidth<' if &softtabstop != -1 - let &softtabstop = &shiftwidth + let &l:softtabstop = &l:shiftwidth let b:undo_indent .= '|setlocal softtabstop<' endif diff --git a/vim/after/indent/make.vim b/vim/after/indent/make.vim index 341cd7f6..d45487b4 100644 --- a/vim/after/indent/make.vim +++ b/vim/after/indent/make.vim @@ -1,4 +1,14 @@ -" Use 'tabstop' (8 columns, a full tab) for indent operations in Makefiles. -" It seems odd that the stock plugin doesn't force this on its own. -setlocal shiftwidth=0 -let b:undo_indent = 'setlocal shiftwidth<' +" Use plain old tabs for Makefiles (of course) +setlocal noexpandtab +let b:undo_indent .= '|setlocal expandtab<' +if v:version > 703 + \ || v:version == 703 && has('patch629') + setlocal shiftwidth=0 +else + let &l:shiftwidth = &l:tabstop +endif +let b:undo_indent .= '|setlocal shiftwidth<' +if &softtabstop != -1 + let &l:softtabstop = &l:shiftwidth + let b:undo_indent .= '|setlocal softtabstop<' +endif diff --git a/vim/autoload/html.vim b/vim/autoload/html.vim index 9466be33..7ac4f9d3 100644 --- a/vim/autoload/html.vim +++ b/vim/autoload/html.vim @@ -28,11 +28,11 @@ function! html#TimestampUpdate() abort endif let cv = winsaveview() call cursor(1,1) - let li = search('\C^\s*<em>Last updated: .\+</em>$', 'n') + let li = search('\m\C^\s*<em>Last updated: .\+</em>$', 'n') if li - let date = substitute(system('date -u'), '\C\n$', '', '') + let date = substitute(system('date -u'), '\n$', '', '') let line = getline(li) - call setline(li, substitute(line, '\C\S.*', + call setline(li, substitute(line, '\S.*', \ '<em>Last updated: '.date.'</em>', '')) endif call winrestview(cv) diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim index 40b7fb7f..3fbba860 100644 --- a/vim/autoload/mail.vim +++ b/vim/autoload/mail.vim @@ -79,3 +79,26 @@ function! mail#NewBlank(count, up, visual) abort endif endfunction + +function! mail#StrictQuote(start, end) abort + let body = 0 + for lnum in range(a:start, a:end) + + " Get current line + let line = getline(lnum) + + " 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 diff --git a/vim/autoload/spellfile_local.vim b/vim/autoload/spellfile_local.vim index f3d9b987..e119b718 100644 --- a/vim/autoload/spellfile_local.vim +++ b/vim/autoload/spellfile_local.vim @@ -42,7 +42,7 @@ function! spellfile_local#() abort endif try - let path = substitute(expand('%:p'), '/', '%', 'g') + let path = tr(expand('%:p'), '/', '%') if path ==# '' echoerr 'Blank path' endif diff --git a/vim/bundle/digraph_search b/vim/bundle/digraph_search -Subproject 005fb8c6e4042e8eca2af224b9ada2d61824f9b +Subproject 06eb698192dfa4ea64458aa1483d024d251e82e diff --git a/vim/bundle/paste_insert b/vim/bundle/paste_insert -Subproject 6a8fda5f3dd282bddf4c9353fee08c17aaf6339 +Subproject 17de75eb35838c3f588f1556f53dc574d78a2fa diff --git a/vim/indent/csv.vim b/vim/indent/csv.vim index a9aba056..e97ab29e 100644 --- a/vim/indent/csv.vim +++ b/vim/indent/csv.vim @@ -10,8 +10,14 @@ let b:undo_indent = 'setlocal autoindent<' " Literal tabs setlocal noexpandtab -setlocal shiftwidth=0 -let b:undo_indent = 'setlocal expandtab< shiftwidth<' +let b:undo_indent .= '|setlocal expandtab<' +if v:version > 703 + \ || v:version == 703 && has('patch629') + setlocal shiftwidth=0 +else + let &l:shiftwidth = &l:tabstop +endif +let b:undo_indent .= '|setlocal shiftwidth<' if &softtabstop != -1 let &l:softtabstop = &l:shiftwidth let b:undo_indent .= '|setlocal softtabstop<' diff --git a/vim/indent/help.vim b/vim/indent/help.vim index c49e1ced..78de85d0 100644 --- a/vim/indent/help.vim +++ b/vim/indent/help.vim @@ -4,11 +4,17 @@ if exists('b:did_indent') endif let b:did_indent = 1 -" Use hard tabs for editing Vim help files +" Literal tabs setlocal noexpandtab -setlocal shiftwidth=0 -let b:undo_indent = 'setlocal expandtab< shiftwidth<' +let b:undo_indent = 'setlocal expandtab<' +if v:version > 703 + \ || v:version == 703 && has('patch629') + setlocal shiftwidth=0 +else + let &l:shiftwidth = &l:tabstop +endif +let b:undo_indent .= '|setlocal shiftwidth<' if &softtabstop != -1 - let &softtabstop = &shiftwidth - let b:undo_indent = 'setlocal softtabstop<' + let &l:softtabstop = &l:shiftwidth + let b:undo_indent .= '|setlocal softtabstop<' endif |