From de977486005f37bf102349cf13ac343582016b40 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 23 May 2019 14:44:21 +1200 Subject: Use get() for mail buffer variable fetch --- vim/autoload/quote.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'vim/autoload/quote.vim') diff --git a/vim/autoload/quote.vim b/vim/autoload/quote.vim index b84a87e8..b519e717 100644 --- a/vim/autoload/quote.vim +++ b/vim/autoload/quote.vim @@ -10,9 +10,7 @@ endfunction function! quote#QuoteOpfunc(type) abort " May as well make this configurable - let char = exists('b:quote_char') - \ ? b:quote_char - \ : '>' + let char = get(b:, 'quote_char', '>') " Iterate over each matched line for li in range(line('''['), line(''']')) -- cgit v1.2.3 From 9a9f02405fee72a442bcd48fc0d9227727bb79ec Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 23 May 2019 14:45:17 +1200 Subject: Make space appending for quote indent configurable --- vim/autoload/quote.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'vim/autoload/quote.vim') 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 -- cgit v1.2.3