aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/quote.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-23 14:57:52 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-23 14:57:52 +1200
commit25989141c2ec675ce4b63fff6025776596c1ff5b (patch)
treed8148c9b94ed16ebe2cba7ef765f471c6651c6ef /vim/autoload/quote.vim
parent5c31ba982a084dd55d232a9ebea5551f1d4f7455 (diff)
parent37ab0d3e9799924f14f55c09104e45c218fd6402 (diff)
downloaddotfiles-25989141c2ec675ce4b63fff6025776596c1ff5b.tar.gz
dotfiles-25989141c2ec675ce4b63fff6025776596c1ff5b.zip
Merge branch 'release/v4.42.0'v4.42.0
* release/v4.42.0: Bump VERSION Delete blank lines at top of quoted reply Don't add spaces when quoting mail Make space appending for quote indent configurable Use get() for mail buffer variable fetch
Diffstat (limited to 'vim/autoload/quote.vim')
-rw-r--r--vim/autoload/quote.vim19
1 files changed, 10 insertions, 9 deletions
diff --git a/vim/autoload/quote.vim b/vim/autoload/quote.vim
index b84a87e8..616fd307 100644
--- a/vim/autoload/quote.vim
+++ b/vim/autoload/quote.vim
@@ -9,10 +9,9 @@ endfunction
" Quoting operator function
function! quote#QuoteOpfunc(type) abort
- " May as well make this configurable
- let char = exists('b:quote_char')
- \ ? b:quote_char
- \ : '>'
+ " Make character and space appending configurable
+ let char = get(b:, 'quote_char', '>')
+ let space = get(b:, 'quote_space', 1)
" Iterate over each matched line
for li in range(line('''['), line(''']'))
@@ -25,11 +24,13 @@ function! quote#QuoteOpfunc(type) abort
continue
endif
- " Only add a space after the quote character if this line isn't already
- " quoted with the same character
- let new = cur[0] == char
- \ ? char.cur
- \ : char.' '.cur
+ " If configured to do so, add a a space after the quote character, but
+ " only if this line isn't already quoted
+ let new = char
+ if l:space && cur[0] != char
+ let new .= ' '
+ endif
+ let new .= cur
call setline(li, new)
endfor