From 546a2177e8c7dcda6895b25c5f4b0f6e83707e1d Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Wed, 29 Jan 2014 13:25:33 +0000 Subject: [PATCH] Always use cursorline with a highlight. Use cursorline when CursorLineNr is supported, with no background formatting on the line itself but a highlight in the number column. --- .vim/colors/iain.vim | 3 ++- .vimrc | 33 ++++++++++++--------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.vim/colors/iain.vim b/.vim/colors/iain.vim index 38dcc24..45dce40 100644 --- a/.vim/colors/iain.vim +++ b/.vim/colors/iain.vim @@ -260,6 +260,7 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256 call X("Folded", "#808080", "#303030", "") call X("FoldColumn", "#808080", "#303030", "") call X("LineNr", "#90f020", "#303030", "") + call X("CursorLineNr", "#303030", "#90f020", "none") call X("DiffAdd", "", "#008bff", "") call X("DiffChange", "", "#8b008b", "") call X("DiffDelete", "#008b8b", "#303030", "") @@ -296,7 +297,7 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256 hi! link TabLineSel StatusLine hi! link TabLine StatusLineNC - hi! link CursorColumn CursorLine + hi clear CursorLine hi MatchParen ctermbg=blue diff --git a/.vimrc b/.vimrc index 426e394..29b0b6d 100644 --- a/.vimrc +++ b/.vimrc @@ -212,7 +212,6 @@ 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) call Prep_Var("b:iainalt", 0) if has("signs") call Prep_Var("g:marksigns", 0) @@ -1184,22 +1183,6 @@ 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 =~# "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 - " Handle searching in a BufExplorer window. fun! BufExplorer_Search(n) "{{{2 if a:n == 0 @@ -1251,10 +1234,6 @@ if has("autocmd") au StatusLine InsertEnter * call Highlight_StatusLine("I") au StatusLine InsertLeave * call Highlight_StatusLine("i") - if has("syntax") - au Display FocusGained,FocusLost * call ToggleCursorLine() - endif - if has("signs") au Signs CursorHoldI * call Highlight_Signs() au Signs InsertEnter * call Highlight_Signs() @@ -1452,6 +1431,18 @@ if has("autocmd") endif endif "}}}1 +" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Handle options only available in Vim 7.4 and above. +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if version >= "704" "{{{1 +version 7.4 + +if has("syntax") + se cursorline +endif + +endif "}}}1 " Resize after startup. if version >= "500" "{{{1 -- 2.7.4