diff --git a/README.md b/README.md index e50a8c7..144b5ed 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,14 @@ Features }| +* Support ``` ''' and """ + + input: + ''' + + output: + ''' + Shortcuts --------- @@ -89,7 +97,7 @@ Options ------- * g:AutoPairs - Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"'} + Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} * g:AutoPairsShortcutToggle diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index dd8a683..04fea83 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -1,7 +1,7 @@ " Insert or delete brackets, parens, quotes in pairs. " Maintainer: JiangMiao " Contributor: camthompson -" Last Change: 2011-12-29 +" Last Change: 2012-01-17 " Version: 1.1.4 " Homepage: http://www.vim.org/scripts/script.php?script_id=3599 " Repository: https://github.com/jiangmiao/auto-pairs @@ -116,6 +116,16 @@ function! AutoPairsInsert(key) return a:key 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."\" endfunction