Currently when I open a file (NerdTree appears automatically as well), the light line status line plugin I installed does not show up right away. It only shows up after I switch tabs into NerdTree and then back to the file I have open. The first picture is what the file I open looks like right away, the second is after I switch into nerdtree and then back into my file. Obviously this switching business is quite annoying, so how can I avoid this? The pictures are with my vimrc for reference. Thanks.
I too had encountered a similar problem. In my case, there was a missing (external) executable, leading to an error in Vim on startup, thus preventing lightline from loading correctly.
I found that switching windows and opening a new split 'fixed' the issue, ie. adding/moving between splits resulted in lightline updating the statusline correctly.
Poking around the source code (plugin/lightline.vim) I found the following line:
autocmd WinEnter,BufEnter,BufDelete,SessionLoadPost,FileChangedShellPost * call lightline#update()
As I understand it, it is this autocmd that helps to update the statusline correctly as one moves between splits. (In your case, switching to NerdTree and back)
Now, what we want is for lightline to update the statusline once Vim is started... This is the
autocmd VimEnter * call lightline#update()
to your vimrc should resolve the issue.