diff --git a/README.md b/README.md index 102df4d..e50a8c7 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,11 @@ Features input: '|' (press at |) output: ' |' +* Skip ' when inside a word + + input: foo| (press ' at |) + output: foo' + * Skip closed bracket. input: [] @@ -155,4 +160,7 @@ TroubleShooting 3. use DEL or x to delete the character insert by plugin. - + +Contributors +------------ +* [camthompson](https://github.com/camthompson) diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index 1738c50..3d0d8cc 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -1,7 +1,8 @@ " Insert or delete brackets, parens, quotes in pairs. " Maintainer: JiangMiao -" Last Change: 2011-12-13 -" Version: 1.1.3 +" Contributor: camthompson +" Last Change: 2011-12-29 +" Version: 1.1.4 " Homepage: http://www.vim.org/scripts/script.php?script_id=3599 " Repository: https://github.com/jiangmiao/auto-pairs @@ -77,6 +78,11 @@ function! AutoPairsInsert(key) return a:key end + " Ignore ' if follows a word + if a:key == "'" && prev_char =~ '\v\w' + return a:key + end + if !has_key(g:AutoPairs, a:key) " Skip the character if next character is space @@ -110,10 +116,7 @@ function! AutoPairsInsert(key) return "\" end - if a:key == "'" && prev_char =~ '\v\w' - return a:key - else - return open.close."\" + return open.close."\" endfunction function! AutoPairsDelete()