Reputation: 202
I tweaked my statusline in vim a little, and started to like it. I use autosession.vim so when I reopen, I have the same files open, but the statusline loses all color settings. If I wipe buffer and reopen, the colors are back (or, if I source ~/.vimrc).
Am I doing something wrong or is it just the nature of buffer, that after reopening session the statusline loses color settings? Pictures follow:
It might be worth mentioning that I use gvim on ArchLinux.
Upvotes: 2
Views: 1203
Reputation: 183
.vimrc
after session finish loading, so you'll have all your seetings back:Open you shell configuration file (.bashrc
or .zshrc
, etc) and write this function:
vims() {
vim -S "$1" -c 'source ~/.vimrc'
}
After saving and sourcing the shell config file (or restarting the shell) you'll be always able to open a vim session with the command...
vims mysession.vim
...and it's done! :)
Upvotes: 0
Reputation: 11
In order to solve this add the following to your .vimrc for each user color:
autocmd SessionLoadPost * hi User1 guifg=#112005 guibg=#009099
SessionLoadPost triggers after the session file is loaded and re-activates your custom colors.
Upvotes: 1
Reputation: 172768
Your custom highlightings may get lost because of a :syntax on
command when the session is restored. In addition to defining your custom highlightings like this:
:hi User1 guibg=Blue
add an autocmd that restores them:
:autocmd ColorScheme * hi User1 guibg=Blue
Upvotes: 2
Reputation: 393924
You can debug what overrides the statusline setting by doing
:verbose set statusline?
This will tell you were the value was last set
statusline=.....
Last set from C:\Program Files\Vim\_vimrc
Upvotes: 0