From: Iain Patterson Date: Tue, 6 Oct 2009 10:08:26 +0000 (+0100) Subject: Highlight cursor line when focus is lost. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=d1c7f1b4ee2672f0a1ed385cd8d887914d8372d0;p=profile.git Highlight cursor line when focus is lost. Set cursorline on FocusLost. Unset cursorline on FocusGained iff it wasn't set before focus was lost. --- diff --git a/.vimrc b/.vimrc index 24e05bc..71c5093 100644 --- a/.vimrc +++ b/.vimrc @@ -174,6 +174,7 @@ fun! Iain_Vars() "{{{2 call Prep_Var("b:iainstatus", "'Fih'") call Prep_Var("g:iainextracolumnsnumber", "''") call Prep_Var("g:iainextracolumnslist", "''") + call Prep_Var("b:iaincul", 0) if has("signs") call Prep_Var("g:marksigns", 0) call Prep_Var("g:firstsign", 100) @@ -1002,6 +1003,19 @@ fun! Show_GUITabLine() "{{{2 return l:s endfun "}}}2 +" Toggle highlighting cursor line when focus changes. +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 + endif +endfun "}}}2 + se tabline=%!Show_TabLine() se guitablabel=%!Show_GUITabLine() @@ -1012,6 +1026,8 @@ au StatusLine FocusLost * call Highlight_StatusLine("f") au StatusLine InsertEnter * call Highlight_StatusLine("I") au StatusLine InsertLeave * call Highlight_StatusLine("i") +au Display FocusGained,FocusLost * call ToggleCursorLine() + if has("signs") au Signs InsertEnter * call Highlight_Signs() au Signs InsertLeave * call Highlight_Signs()