From 4a02e2c48874332625ff5480ab3eaa1c31e2365a Mon Sep 17 00:00:00 2001 From: "jiangfriend@gmail.com" Date: Thu, 30 Aug 2012 14:59:44 +0800 Subject: [PATCH] Fixes indentation incorrect when returning below 1/3 bottom of window. --- plugin/auto-pairs.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index d92911e..93b7d32 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -261,6 +261,9 @@ function! AutoPairsToggle() endfunction function! AutoPairsReturn() + if b:autopairs_enabled == 0 + return '' + end let line = getline('.') let pline = getline(line('.')-1) let prev_char = pline[strlen(pline)-1] @@ -268,7 +271,10 @@ function! AutoPairsReturn() let cur_char = line[col('.')-1] if has_key(g:AutoPairs, prev_char) && g:AutoPairs[prev_char] == cur_char if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2 - let cmd = " \zz\" + " Use \ instead of \cl will cause the placeholder deleted + " incorrect. because zz won't leave Normal mode. + " Use \ is a bit wierd. the character before cursor need to be deleted. + let cmd = " \zz\cl" end " conflict with javascript and coffee " javascript need indent new line