From 10f56aad0e9032aa2bc9a2efc46e6085e82633b5 Mon Sep 17 00:00:00 2001 From: "jiangfriend@gmail.com" Date: Tue, 17 Jan 2012 13:17:21 +0800 Subject: [PATCH] NEW support ```, ''', """ --- README.md | 10 +++++++++- plugin/auto-pairs.vim | 12 +++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) 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