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
parentMerge branch 'release/v4.41.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-4.42.0.tar.gz (sig)
dotfiles-4.42.0.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