From 1c77e5f1b0746d4d6e8ca46e8faa7b6cdbf38b2e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 18:52:56 +1200 Subject: Make :StrictQuote command accept a range --- vim/after/ftplugin/mail.vim | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index f4a4c91d..1cc3fd14 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -49,19 +49,13 @@ let b:undo_ftplugin .= '|delcommand SuggestStart' SuggestStart " Normalise quoting -function! s:StrictQuote() abort +function! s:StrictQuote(start, end) abort let body = 0 - for lnum in range(1, line('$')) + for lnum in range(a:start, a:end) " 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) @@ -77,8 +71,8 @@ function! s:StrictQuote() abort endfor endfunction -command -bar -buffer StrictQuote - \ call s:StrictQuote() +command -buffer -bar -range=% StrictQuote + \ call s:StrictQuote(, ) let b:undo_ftplugin .= '|delcommand StrictQuote' StrictQuote -- cgit v1.2.3 From 07e5bb7884301d8f952f630aad090a6b03448295 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 18:53:13 +1200 Subject: Don't do :StrictQuote automatically on mail edit --- vim/after/ftplugin/mail.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 1cc3fd14..6b6d4926 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -74,7 +74,6 @@ endfunction command -buffer -bar -range=% StrictQuote \ call s:StrictQuote(, ) let b:undo_ftplugin .= '|delcommand StrictQuote' -StrictQuote " Add a space to the end of wrapped lines for format-flowed mail setlocal formatoptions+=w -- cgit v1.2.3 From 2a7e2b14d3046ab05f222a4e0d7173d9e7f97f53 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 18:55:27 +1200 Subject: Add local maps for normalising mail quotes --- vim/after/ftplugin/mail.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 6b6d4926..2083aaaf 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -73,6 +73,10 @@ function! s:StrictQuote(start, end) abort endfunction command -buffer -bar -range=% StrictQuote \ call s:StrictQuote(, ) +nnoremap s + \ :StrictQuote +xnoremap s + \ :StrictQuote let b:undo_ftplugin .= '|delcommand StrictQuote' " Add a space to the end of wrapped lines for format-flowed mail -- cgit v1.2.3 From 009bd6626ea6e33b59a31a219df628ed0cc5a46c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 19:00:32 +1200 Subject: Move mail ftplugin function out into autoload Now that it isn't called on every load. --- vim/after/ftplugin/mail.vim | 24 +----------------------- vim/autoload/mail.vim | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 2083aaaf..90278bbe 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -49,30 +49,8 @@ let b:undo_ftplugin .= '|delcommand SuggestStart' SuggestStart " Normalise quoting -function! s: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 command -buffer -bar -range=% StrictQuote - \ call s:StrictQuote(, ) + \ call mail#StrictQuote(, ) nnoremap s \ :StrictQuote xnoremap s 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 -- cgit v1.2.3 From a1ab7dc01b88f19ee24f592d3d17e39ad3af13f0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 19:00:49 +1200 Subject: Improve honesty of comment in mail ftplugin --- vim/after/ftplugin/mail.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 90278bbe..53260a49 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 -- cgit v1.2.3 From 9487591c0cfaf509318fd9c14d3d2209c641c6fd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 19:01:00 +1200 Subject: Don't squeeze blanks by default in mail filetype --- vim/after/ftplugin/mail.vim | 9 --------- 1 file changed, 9 deletions(-) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 53260a49..9f8fc608 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -62,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) -- cgit v1.2.3 From 9931b35cc197c76350b2e22e0a1fe6536888ac53 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 21:54:41 +1200 Subject: Correct indent settings --- vim/after/indent/c.vim | 14 ++++++++++---- vim/after/indent/gitconfig.vim | 12 +++++++++--- vim/after/indent/make.vim | 18 ++++++++++++++---- vim/indent/csv.vim | 10 ++++++++-- vim/indent/help.vim | 16 +++++++++++----- 5 files changed, 52 insertions(+), 18 deletions(-) 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/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 -- cgit v1.2.3 From d0d273abed2325caf319ba9f795f1d89a3028e1e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 22:07:35 +1200 Subject: Update digraph_search.vim to v1.1.0 --- vim/bundle/digraph_search | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/digraph_search b/vim/bundle/digraph_search index 005fb8c6..06eb6981 160000 --- a/vim/bundle/digraph_search +++ b/vim/bundle/digraph_search @@ -1 +1 @@ -Subproject commit 005fb8c6e4042e8eca2af224b9ada2d61824f9b5 +Subproject commit 06eb698192dfa4ea64458aa1483d024d251e82ec -- cgit v1.2.3 From 2cbdbf0baf4212e48fefb168cc7914f1dabdb80c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 22:08:08 +1200 Subject: Fix up some pattern qualifiers --- vim/autoload/html.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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*Last updated: .\+$', 'n') + let li = search('\m\C^\s*Last updated: .\+$', '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.*', \ 'Last updated: '.date.'', '')) endif call winrestview(cv) -- cgit v1.2.3 From b0d745efdd39ea1e08461b99c9128af5ea22c364 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 22:08:34 +1200 Subject: Use tr() over substitute() for character swap I didn't know this function existed, but I should perhaps have guessed. --- vim/autoload/spellfile_local.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From 36ee60f0e46250ae8922493dfbfdf56273dd86db Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 23 Jun 2019 01:25:14 +1200 Subject: Update paste_insert.vim to v0.3.0 --- vim/bundle/paste_insert | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/paste_insert b/vim/bundle/paste_insert index 6a8fda5f..17de75eb 160000 --- a/vim/bundle/paste_insert +++ b/vim/bundle/paste_insert @@ -1 +1 @@ -Subproject commit 6a8fda5f3dd282bddf4c9353fee08c17aaf63396 +Subproject commit 17de75eb35838c3f588f1556f53dc574d78a2faf -- cgit v1.2.3 From eeef961a29507c55e24724b18a47c345ecad70d6 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 23 Jun 2019 01:26:12 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index bb79a4b4..7aceb345 100644 --- a/VERSION +++ b/VERSION @@ -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 -- cgit v1.2.3