From 29026c610960a7d96280aa72b4bd0a7394792001 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Fri, 8 Oct 2010 11:00:41 +0100 Subject: [PATCH] Fix restoring cursorline after focus change. If focus was lost for the first time after manually setting cursorline but we were NOT held in insert mode, cursorline would incorrectly be unset when focus was restored. Losing focus for the first time after manually setting cursorline when held in insert mode behaved correctly. --- .vimrc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.vimrc b/.vimrc index 03862f6..9c7457a 100644 --- a/.vimrc +++ b/.vimrc @@ -1129,12 +1129,15 @@ endfun "}}}2 fun! ToggleCursorLine() "{{{2 call Iain_Vars() - if b:iainstatus =~# "f" && b:iainstatus =~# "H" && b:iainstatus =~# "I" - " Focus lost while held in insert mode. - let b:iaincul = getbufvar("", "&cursorline") - setlocal cursorline - elseif ! b:iaincul - setlocal nocursorline + if b:iainstatus =~# "H" && b:iainstatus =~# "I" + " We are held in insert mode. + if b:iainstatus =~# "f" + " And focus was lost. + let b:iaincul = getbufvar("", "&cursorline") + setlocal cursorline + elseif ! b:iaincul + setlocal nocursorline + endif endif endfun "}}}2 -- 2.20.1