From dfc850b7e46a427c98ef9408b4df49505cf6f74b Mon Sep 17 00:00:00 2001 From: Yggdroot Date: Wed, 4 Mar 2020 14:16:51 +0800 Subject: [PATCH] Cursor position is wrong on startup --- after/plugin/indentLine.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/after/plugin/indentLine.vim b/after/plugin/indentLine.vim index 03ef81a..03188f0 100644 --- a/after/plugin/indentLine.vim +++ b/after/plugin/indentLine.vim @@ -127,6 +127,13 @@ function! s:DisableOnDiff() endif endfunction +"{{{1 function! s:VimEnter() +function! s:VimEnter() + let init_winnr = winnr() + noautocmd windo call s:DisableOnDiff() + noautocmd exec init_winnr . "wincmd w" +endfunction + "{{{1 function! s:ToggleOnDiff() function! s:ToggleOnDiff() if &diff @@ -394,7 +401,7 @@ augroup indentLine if exists("##OptionSet") autocmd OptionSet diff call s:ToggleOnDiff() endif - autocmd VimEnter * noautocmd windo call s:DisableOnDiff() + autocmd VimEnter * call s:VimEnter() else autocmd BufWinEnter * call s:Setup() autocmd User * if exists("b:indentLine_enabled") || exists("b:indentLine_leadingSpaceEnabled") | @@ -406,7 +413,7 @@ augroup indentLine if exists("##OptionSet") autocmd OptionSet diff call s:ToggleOnDiff() endif - autocmd VimEnter * noautocmd windo call s:DisableOnDiff() + autocmd VimEnter * call s:VimEnter() endif augroup END