itchyny/lightline.vim

Use Dark Status Line without Setting Background Dark

dandelion-sea opened this issue · 2 comments

I'am using Windows Terminal and connectting a remote Ubuntu 18.04 via ssh, and I want to use theme one.

20230331_214033_295_WindowsTerminal

If I set only 'colorscheme': 'one', the status line is white,

20230331_214137_947_WindowsTerminal

And If set backrgound=dark too, the main pane color changes.

Is there a way to use the one-dark status-line without changing the color of the main pane? I have read some documents and issues, but unfortunately, I didn't find a solution.

Software Versions
  • lightline version: b1e91b4 (latest for now)
  • vim: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
  • vim-plug: 034e8445908e828351da6e428022d8487c57ce99 (latest for now)
  • OS version: Linux hostname 4.15.0-48-generic # 51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

The colorscheme merges the background variants for maintainability and code deduplication. You can workaround this issue.

set background=dark
execute 'source' globpath(&rtp, 'autoload/lightline/colorscheme/one.vim')
set background=light

I am using vim-plug plugin manager. When I first time put the code just below the line Plug 'itchyny/lightline.vim', I got error:

$ vim ~/.vimrc
Error detected while processing /home/username/.vimrc:
line   44:
E471: Argument required
Press ENTER or type command to continue

I was initially confused about the error for several minutes, until I realized that the plugin is not finally loaded, so the variable rtp is not updated, therefore globpath search returns empty string, and causes a lack of argument.

Finally, I move the three lines to the bottom of my .vimrc, and now it works perfectly!

Here's the structure of my current .vimrc file:

" junegunn/vim-plug plugin manager
call plug#begin()
Plug '...'

Plug 'itchyny/lightline.vim'
let g:lightline = {
      \ 'colorscheme': 'one'
      \ }
set laststatus=2
set noshowmode

Plug '...'
Plug '...'

call plug#end()


" lightline: use one-dark theme
set background=dark
execute 'source' globpath(&rtp, 'autoload/lightline/colorscheme/one.vim')
set background=light

Thank you for your helpful response!