diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-23 14:45:17 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-23 14:45:17 +1200 |
commit | 9a9f02405fee72a442bcd48fc0d9227727bb79ec (patch) | |
tree | d646e01a940ebc316c053b2b777e2d809cd19bef /vim | |
parent | Use get() for mail buffer variable fetch (diff) | |
download | dotfiles-9a9f02405fee72a442bcd48fc0d9227727bb79ec.tar.gz dotfiles-9a9f02405fee72a442bcd48fc0d9227727bb79ec.zip |
Make space appending for quote indent configurable
Diffstat (limited to 'vim')
-rw-r--r-- | vim/autoload/quote.vim | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/vim/autoload/quote.vim b/vim/autoload/quote.vim index b519e717..616fd307 100644 --- a/vim/autoload/quote.vim +++ b/vim/autoload/quote.vim @@ -9,8 +9,9 @@ endfunction " Quoting operator function function! quote#QuoteOpfunc(type) abort - " May as well make this configurable + " 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(''']')) @@ -23,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 |