Given this ~/.vimrc
syntax on
colo pablo
set cul
hi CursorLine cterm=bold ctermbg=NONE ctermfg=NONE gui=bold guibg=NONE guifg=NONE
hi String ctermfg=red
Do the following:
- open a file, possibly containing some string (so a double quoted sting in Vim or on C++, for instance);
- observerve that, expectedly,
- the coloring of the strings is
red, not the one dictated bypablo - the current line is highlighted with bold text rather than with the true underline dictated by
pablo
- the coloring of the strings is
- run
:mksession - close the file
- reopen the session with
vim -S Session.vim - observe that, unexpectedly to me, the file opens just like the 4th and 5th line of the
~/.vimrcwere not there.
In the following screencast you can see the effect on the colors of the strings (not on the underline, unfortunately, because of how asciinema works, I guess).

vim -S Session.vimwould be better. – Enlico Oct 02 '20 at 07:23:verbose :hi Stringreturn? – Christian Brabandt Oct 02 '20 at 11:33String xxx ctermfg=9when opening without-S,String xxx links to Constantwhen opening with-S. – Enlico Oct 02 '20 at 14:20autocmd ColorScheme *fixes the thing when I open with-S, but breaks it when I don't (it kind of inverts the behavior); so I tried putting those two lines both inside and outside the autocommand, and it works. But it looks a lot like the wrong way to me. What do you think? – Enlico Oct 02 '20 at 14:27hicommands only in theautocmdmakes them not executed upon startup of Vim (but they are executed if I open viavim -S Session.vim), so there's no session file I can peek in. – Enlico Oct 02 '20 at 14:53Session.vim? – D. Ben Knoble Oct 02 '20 at 15:10hicommand only in theautocmd ColorScheme *, and I open a file withvim that_file, I see that the twohicommand have no effect. And this is before I even think of creating a session. – Enlico Oct 02 '20 at 15:28hicommands that happen to be in vimrc into that autocmd, before I callcolo whatever, right? – Enlico Oct 02 '20 at 15:33