I had a similar problem with setting the cursor selection, but mine was triggered by the mksession command, which I used to save session information during vim's exit. Then this session is automatically restored during program startup if it starts without file arguments.
If anyone has such a .vimrc setting, you can add the following to .vimrc to correctly select the cursor selection: -
function s:SetCursorLine() set cursorline hi cursorline cterm=none ctermbg=darkblue ctermfg=white endfunction autocmd VimEnter * call s:SetCursorLine()
Explain a little why this works. Along with various buffer and window information, mksession saves the current color scheme name. This is restored during program startup by restoring the session. However, since session recovery is usually performed after .vimrc is started (usually using a function called through "autocmd VimEnter *"), the cursor selection in .vimrc is reset to the default for the restored color scheme.
The above function, called through autocmd, will be run after all initialization is complete and, therefore, will successfully configure the cursor selection.
NTN.
Hari Mahadevan Aug 04 '14 at 22:48 2014-08-04 22:48
source share