Closed f0s3 closed 4 years ago
Update: If I install sessionman, the color scheme is applied properly, but the NERDTree is not restored with this plugin.
I have solved this issue by myself by putting a workaround code in my vimrc. Here is the code:
if !exists("autocommands_loaded")
let autocommands_loaded = 1
call feedkeys("\<F3>")
endif
NOTE: This workaround works on top of my vimrc, which has one important line for this to work. Here is the line, using which the code above works:
nnoremap <F3> :execute 'OpenSession! ' . substitute(getcwd(), '^.*/', '', '')<CR>
This line opens session passing the filename of the directory, in which the vim was opened.
THIS SOLUTION IS NOT FULLY COPY-PASTEABLE!
Here is my vimrc. Please comment out
Plug 'ycm-core/YouCompleteMe'
if you want to reproduce issue's behavior(it will save you some time).The issue is as follows: When I open vim in the project folder using the command
vim
and open any file which vim can syntax highlight, it opens just fine and everything is as colorful as it should be. Then I save this session and exit vim using:x
.When opening it again, the session should be restored as I have
autocmd VimEnter * if argc() == 0 | :execute 'OpenSession! ' . substitute(getcwd(), '^.*/', '', '') | endif
in my vimrc, which it does.But the issue is that color scheme is applied partially for the file that was opened in previous session. If the issue seems unclear, let me know and I will attach some screenshots for it.
:colorscheme
shows that the theme is loaded.Also note that if I press F3, which in my vimrc is mapped to
nnoremap <F3> :execute 'OpenSession! ' . substitute(getcwd(), '^.*/', '', '')<CR>
, the session gets restored properly with all the syntax highlighting.What I tried: