Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Shift + Backspace inside an empty pair will delete the closing deli…

…miter.
  • Loading branch information...
commit 23326b1178b1cba4e912aadd9357859aefce5e09 1 parent 2e786b5
@Raimondi authored
Showing with 13 additions and 7 deletions.
  1. +4 −0 Makefile
  2. +9 −7 plugin/delimitMate.vim
View
4 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
+
View
16 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.
+ " Seems like a escaped character, insert one quotation mark.
return a:char
+ elseif line[col - 1] == a:char
+ " Get out of the string.
+ return "\<Right>"
elseif line[col - 2] == a:char && line[col - 1 ] != a:char
- " Seems like we have an unbalanced quote, insert a single
- " quotation mark.
+ " Seems like we have an unbalanced quote, insert one quotation mark.
return a:char."\<Left>"
elseif a:char == "'" && line[col -2 ] =~ '[a-zA-Z0-9]'
" Seems like we follow a word, insert an apostrophe.
return a:char
- elseif line[col - 1] == a:char
- " Get out of the string.
- return "\<Right>"
else
" Insert a pair and jump to the middle.
return a:char.a:char."\<Left>"
@@ -299,7 +298,7 @@ function! s:AutoClose() "{{{1
exec 'inoremap <buffer> ' . delim . ' <C-R>=<SID>ClosePair("\' . delim . '")<CR>'
endfor
- " Try to fix the use of apostrophes:
+ " Try to fix the use of apostrophes (de-activated by default):
" inoremap <buffer> n't n't
for map in s:apostrophes
exec "inoremap <buffer> " . map . " " . map
@@ -373,6 +372,9 @@ function! s:ExtraMappings() "{{{1
" If pair is empty, delete both delimiters:
inoremap <buffer> <expr> <BS> <SID>WithinEmptyPair() ? "\<Right>\<BS>\<BS>" : "\<BS>"
+ " If pair is empty, delete closing delimiter:
+ inoremap <buffer> <expr> <S-BS> <SID>WithinEmptyPair() ? "\<Del>" : "\<S-BS>"
+
" Expand return if inside an empty pair:
if exists("b:delimitMate_expand_cr") || exists("g:delimitMate_expand_cr")
inoremap <buffer> <CR> <C-R>=<SID>ExpandReturn()<CR>
Please sign in to comment.
Something went wrong with that request. Please try again.