diff --git a/Makefile b/Makefile index 1009eb3..a99f572 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,7 @@ vimball: install echo doc/${PLUGIN}.txt > vimball.txt echo plugin/${PLUGIN}.vim >> vimball.txt vim -c 'e vimball.txt' -c '%MkVimball! ${PLUGIN}' -c 'q' + +gzip: vimball + gzip -f ${PLUGIN}.vba + diff --git a/plugin/delimitMate.vim b/plugin/delimitMate.vim index eeef0b6..db3769a 100644 --- a/plugin/delimitMate.vim +++ b/plugin/delimitMate.vim @@ -228,18 +228,17 @@ function! s:QuoteDelim(char) "{{{1 let line = getline('.') let col = col('.') if line[col - 2] == "\\" - " Seems like a escaped character, insert a single quotation mark. - return a:char - elseif line[col - 2] == a:char && line[col - 1 ] != a:char - " Seems like we have an unbalanced quote, insert a single - " quotation mark. - return a:char."\" - elseif a:char == "'" && line[col -2 ] =~ '[a-zA-Z0-9]' - " Seems like we follow a word, insert an apostrophe. + " Seems like a escaped character, insert one quotation mark. return a:char elseif line[col - 1] == a:char " Get out of the string. return "\" + elseif line[col - 2] == a:char && line[col - 1 ] != a:char + " Seems like we have an unbalanced quote, insert one quotation mark. + return a:char."\" + elseif a:char == "'" && line[col -2 ] =~ '[a-zA-Z0-9]' + " Seems like we follow a word, insert an apostrophe. + return a:char else " Insert a pair and jump to the middle. return a:char.a:char."\" @@ -299,7 +298,7 @@ function! s:AutoClose() "{{{1 exec 'inoremap ' . delim . ' =ClosePair("\' . delim . '")' endfor - " Try to fix the use of apostrophes: + " Try to fix the use of apostrophes (de-activated by default): " inoremap n't n't for map in s:apostrophes exec "inoremap " . map . " " . map @@ -373,6 +372,9 @@ function! s:ExtraMappings() "{{{1 " If pair is empty, delete both delimiters: inoremap WithinEmptyPair() ? "\\\" : "\" + " If pair is empty, delete closing delimiter: + inoremap WithinEmptyPair() ? "\" : "\" + " Expand return if inside an empty pair: if exists("b:delimitMate_expand_cr") || exists("g:delimitMate_expand_cr") inoremap =ExpandReturn()