mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-06 12:44:27 +08:00
- Single quote after an alphanumeric character is an apostrophe.
- First attempt to behave nicely with an unbalanced quote.
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
*.sw?
|
||||||
|
*.vba
|
||||||
|
*.zip
|
||||||
|
*.gz
|
||||||
|
vimball.txt
|
||||||
15
Makefile
Normal file
15
Makefile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
PLUGIN=delimitMate
|
||||||
|
|
||||||
|
install:
|
||||||
|
cp -f doc/* ~/.vim/doc/${PLUGIN}.txt
|
||||||
|
cp -f plugin/* ~/.vim/plugin/${PLUGIN}.vim
|
||||||
|
vim -u NONE -c 'helptags ~/.vim/doc' -c 'q'
|
||||||
|
|
||||||
|
zip:
|
||||||
|
zip -r pickacolor.zip doc plugin
|
||||||
|
zip pickacolor.zip -d \*.sw\?
|
||||||
|
|
||||||
|
vimball: install
|
||||||
|
echo doc/${PLUGIN}.txt > vimball.txt
|
||||||
|
echo plugin/${PLUGIN}.vim >> vimball.txt
|
||||||
|
vim -c 'e vimball.txt' -c '%MkVimball! ${PLUGIN}' -c 'q'
|
||||||
@@ -147,7 +147,8 @@ function! s:Init() "{{{1
|
|||||||
endif " }}}
|
endif " }}}
|
||||||
|
|
||||||
if !exists("b:delimitMate_apostrophes") && !exists("g:delimitMate_apostrophes") " {{{
|
if !exists("b:delimitMate_apostrophes") && !exists("g:delimitMate_apostrophes") " {{{
|
||||||
let s:apostrophes = split("n't:'s:'re:'m:'d:'ll:'ve:s'",':')
|
"let s:apostrophes = split("n't:'s:'re:'m:'d:'ll:'ve:s'",':')
|
||||||
|
let s:apostrophes = []
|
||||||
|
|
||||||
elseif exists("b:delimitMate_apostrophes")
|
elseif exists("b:delimitMate_apostrophes")
|
||||||
let s:apostrophes = split(b:delimitMate_apostrophes)
|
let s:apostrophes = split(b:delimitMate_apostrophes)
|
||||||
@@ -170,7 +171,7 @@ function! s:Init() "{{{1
|
|||||||
call s:ExtraMappings()
|
call s:ExtraMappings()
|
||||||
let b:loaded_delimitMate = 1
|
let b:loaded_delimitMate = 1
|
||||||
|
|
||||||
endfunction "}}}1
|
endfunction "}}}1 Init()
|
||||||
|
|
||||||
function! s:ValidMatchpairs(str) "{{{1
|
function! s:ValidMatchpairs(str) "{{{1
|
||||||
if a:str !~ '^.:.\(,.:.\)*$'
|
if a:str !~ '^.:.\(,.:.\)*$'
|
||||||
@@ -229,6 +230,13 @@ function! s:QuoteDelim(char) "{{{1
|
|||||||
if line[col - 2] == "\\"
|
if line[col - 2] == "\\"
|
||||||
" Seems like a escaped character, insert a single quotation mark.
|
" Seems like a escaped character, insert a single quotation mark.
|
||||||
return a:char
|
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."\<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
|
elseif line[col - 1] == a:char
|
||||||
" Get out of the string.
|
" Get out of the string.
|
||||||
return "\<Right>"
|
return "\<Right>"
|
||||||
|
|||||||
Reference in New Issue
Block a user