aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/quote.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-17 10:54:31 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-17 10:55:02 +1200
commit4bdb6ad08291627954b34b1b3387c9373de4ae2a (patch)
tree8fde89ebba527b8d9c1a1b86c46896f7d862b505 /vim/autoload/quote.vim
parentMerge branch 'release/v1.32.0' into develop (diff)
downloaddotfiles-4bdb6ad08291627954b34b1b3387c9373de4ae2a.tar.gz
dotfiles-4bdb6ad08291627954b34b1b3387c9373de4ae2a.zip
Don't quote first and last lines of range if blank
This allows quoting paragraphs and blocks using { } and similar motions, doing what I mean.
Diffstat (limited to 'vim/autoload/quote.vim')
-rw-r--r--vim/autoload/quote.vim9
1 files changed, 8 insertions, 1 deletions
diff --git a/vim/autoload/quote.vim b/vim/autoload/quote.vim
index 26e95698..35df76a4 100644
--- a/vim/autoload/quote.vim
+++ b/vim/autoload/quote.vim
@@ -17,9 +17,16 @@ function! quote#QuoteOpfunc(type) abort
" Iterate over each matched line
for l:li in range(line('''['), line(''']'))
+ " Get current line text
+ let l:cur = getline(l:li)
+
+ " Don't quote the first or last lines if they're blank
+ if !strlen(l:cur) && (l:li == line('''[') || l:li == line(''']'))
+ continue
+ endif
+
" Only add a space after the quote character if this line isn't already
" quoted with the same character
- let l:cur = getline(l:li)
let l:new = stridx(l:cur, l:char) == 0
\ ? l:char.l:cur
\ : l:char.' '.l:cur