itchyny / lightline.vim

A light and configurable statusline/tabline plugin for Vim
MIT License
6.75k stars 315 forks source link

Lightline only working after PlugInstall despite being installed #543

Closed JohnstonLiu closed 3 years ago

JohnstonLiu commented 3 years ago

Lightline will not work on launch. However, when I call :PlugInstall and :q out of the new window I will have lightline working in my old window. This is my vimrc.

if has('gui_running')
    set guifont=Cascadia_Mono:h11
endif

call plug#begin('c:\Program Files\Vim\Plugins')

Plug 'itchyny/lightline.vim'
Plug 'morhetz/gruvbox'

call plug#end()

" Editor settings
set encoding=utf-8
set relativenumber " Show's relative line numbers
set number         " Show's current line
set signcolumn=no
syntax on
set hidden
set belloff=all
set guicursor=a:blinkon0
colorscheme gruvbox 
set noshowmode
set laststatus=2

" Tabs
set tabstop=4     " Tab characters appear n-spaces-wide
set shiftwidth=4  " The size of an indent
set expandtab

" Lightline

let g:lightline = {
      \ 'colorscheme': 'gruvbox',
      \ }

autocmd filetype cpp nnoremap <F1> :w <bar> exec '!g++ -std=c++14 ' .shellescape('%').' -o '.shellescape('%:r').' && 'shellescape('%:r')<CR>
nnoremap <F2> :%y+ <CR>

au GUIEnter * simalt ~x
3719e04 commented 3 years ago

Would lightline work if you remove this line?

au GUIEnter * simalt ~x

It's most likely related to https://github.com/itchyny/lightline.vim/blob/53176a0b75d6389d775d7bce0d494e58fc654f38/plugin/lightline.vim#L18

JohnstonLiu commented 3 years ago

Would lightline work if you remove this line?

au GUIEnter * simalt ~x

It's most likely related to https://github.com/itchyny/lightline.vim/blob/53176a0b75d6389d775d7bce0d494e58fc654f38/plugin/lightline.vim#L18

Just tried that didn't work.

JohnstonLiu commented 3 years ago

After testing I found that lightline is not automatically enabled for some reason. When I call lightline#init() it doesn't do anything but when I do call lightline#enable() lightline will then show. Regardless, why is it that lightline is not automatically enabled?

itchyny commented 3 years ago

Please describe your OS and Vim versions. Also try reinstalling the plugin after removing the directories. Possible reason is permission issues.

JohnstonLiu commented 3 years ago

Please describe your OS and Vim versions. Also try reinstalling the plugin after removing the directories. Possible reason is permission issues.

I'm on Windows 10 and on Vim version 8.2. I have tried reinstalling the plugin to no avail.

itchyny commented 3 years ago

Paste the output of :echo &statusline.

JohnstonLiu commented 3 years ago

Paste the output of :echo &statusline.

There is no output.

itchyny commented 3 years ago

Then :scriptnames.

JohnstonLiu commented 3 years ago

Then :scriptnames.

  1: C:\Program Files\Vim\vim82\defaults.vim
  2: C:\Program Files\Vim\vim82\syntax\syntax.vim
  3: C:\Program Files\Vim\vim82\syntax\synload.vim
  4: C:\Program Files\Vim\vim82\syntax\syncolor.vim
  5: C:\Program Files\Vim\vim82\filetype.vim
  6: C:\Program Files\Vim\vim82\menu.vim
  7: C:\Program Files\Vim\vim82\autoload\paste.vim
  8: C:\Program Files\Vim\vim82\ftplugin.vim
  9: C:\Program Files\Vim\vim82\indent.vim
 10: C:\Program Files\Vim\vim82\plugin\getscriptPlugin.vim
 11: C:\Program Files\Vim\vim82\plugin\gzip.vim
 12: C:\Program Files\Vim\vim82\plugin\logiPat.vim
 13: C:\Program Files\Vim\vim82\plugin\manpager.vim
 14: C:\Program Files\Vim\vim82\plugin\matchparen.vim
 15: C:\Program Files\Vim\vim82\plugin\netrwPlugin.vim
 16: C:\Program Files\Vim\vim82\plugin\rrhelper.vim
 17: C:\Program Files\Vim\vim82\plugin\spellfile.vim
 18: C:\Program Files\Vim\vim82\plugin\tarPlugin.vim
 19: C:\Program Files\Vim\vim82\plugin\tohtml.vim
 20: C:\Program Files\Vim\vim82\plugin\vimballPlugin.vim
 21: C:\Program Files\Vim\vim82\plugin\zipPlugin.vim
 22: ~\_gvimrc
 23: ~\vimfiles\autoload\plug.vim
 24: C:\Program Files\Vim\vim82\ftoff.vim
 25: C:\Program Files\Vim\vim82\syntax\nosyntax.vim
 26: c:\Program Files\Vim\Plugins\gruvbox\colors\gruvbox.vim
3719e04 commented 3 years ago

Maybe it's related to https://github.com/junegunn/vim-plug/issues/540#issuecomment-258325522

In short

So if you have plug#end() in .gvimrc, &runtimepath is updated after step 4 and plugins will not be correctly loaded.

JohnstonLiu commented 3 years ago

Maybe it's related to junegunn/vim-plug#540 (comment)

In short

So if you have plug#end() in .gvimrc, &runtimepath is updated after step 4 and plugins will not be correctly loaded.

Yep thank you! I have to put vim plug configuration in my _vimrc instead of my _gvimrc. Sorry for the trouble!

pavlo-hadzheha commented 3 years ago

Hi, I have a similar problem. but :echo &statusline yields the following: image

but nothing I see.

and :call lightline#enable() doesn't work.

I'm running Windows Subsystem For Linux (WSL) under Windows 10.

image

itchyny commented 3 years ago

@Paulario :echo &laststatus

pavlo-hadzheha commented 3 years ago

@Paulario :echo &laststatus

just number 15. I set laststatus=15 in my config file

image and it works sometimes. One of the ways it appears is in the vim-plug window. Didn't see it anywhere else

I commented the line that sets laststatus=15 and lightline got back suprizingly. I just thought this would be your advice. But what is curious is that it worked in a couple of days before today justfine even with laststatus=15.

so what should I set laststatus to?

itchyny commented 3 years ago

@Paulario Please read :h laststatus.