NEW support ```, ''', """

This commit is contained in:
jiangfriend@gmail.com 2012-01-17 13:17:21 +08:00
parent 6c3bcbca50
commit 10f56aad0e
2 changed files with 20 additions and 2 deletions

View File

@ -70,6 +70,14 @@ Features
}| }|
* Support ``` ''' and """
input:
'''
output:
'''
Shortcuts Shortcuts
--------- ---------
@ -89,7 +97,7 @@ Options
------- -------
* g:AutoPairs * g:AutoPairs
Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"'} Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
* g:AutoPairsShortcutToggle * g:AutoPairsShortcutToggle

View File

@ -1,7 +1,7 @@
" Insert or delete brackets, parens, quotes in pairs. " Insert or delete brackets, parens, quotes in pairs.
" Maintainer: JiangMiao <jiangfriend@gmail.com> " Maintainer: JiangMiao <jiangfriend@gmail.com>
" Contributor: camthompson " Contributor: camthompson
" Last Change: 2011-12-29 " Last Change: 2012-01-17
" Version: 1.1.4 " Version: 1.1.4
" Homepage: http://www.vim.org/scripts/script.php?script_id=3599 " Homepage: http://www.vim.org/scripts/script.php?script_id=3599
" Repository: https://github.com/jiangmiao/auto-pairs " Repository: https://github.com/jiangmiao/auto-pairs
@ -116,6 +116,16 @@ function! AutoPairsInsert(key)
return a:key return a:key
end end
" support for ''' ``` and """
if open == close
" The key must be ' " `
let pprev_char = line[col('.')-3]
if pprev_char == open && prev_char == open
" Double pair found
return a:key
end
end
return open.close."\<Left>" return open.close."\<Left>"
endfunction endfunction