Coder Social home page Coder Social logo

Comments (8)

nhoad avatar nhoad commented on July 30, 2024

I have found setting g:lightline in my .vimrc to be the cause for this issue (for me at least), e.g. let g:lightline = {'colorscheme': 'wombat'}

If I comment out that line, I can source the my config as many times as I like, without error. A conditional unlet g:loaded_lightline does not fix the problem either.

Sorry I can't be more helpful - I don't know vimscript very well :)

from lightline.vim.

itchyny avatar itchyny commented on July 30, 2024

Do you write the lightline setting after the syntax enable setting?

syntax enable
...
let g:lightline = ...
...

What if setting lightline before both enabling syntax and setting the colorscheme?

let g:lightline = ...
colorscheme XXX
syntax enable
...

from lightline.vim.

itchyny avatar itchyny commented on July 30, 2024

Ah, sorry. Order of syntax enable and g:lightline does not matter.
Maybe you may have letting g:lightline after setting the colorscheme.

from lightline.vim.

nhoad avatar nhoad commented on July 30, 2024

I did have colorscheme before g:lightline - swapping them around has fixed it! Thank you very much :)

Out of interest, why is the ordering important here in this case?

from lightline.vim.

itchyny avatar itchyny commented on July 30, 2024

It is a little complicated.

When colorscheme XXX is executed, all the colors of highlight groups are reset, including lightline's.
So lightline detects the colorscheme command and:

  • initializes g:lightline
  • sets the highlight groups of lightline
  • and the statusline for lightline.

The statusline of lightline assumes that g:lightline is properly initialized.
Letting g:lightline after colorscheme command causes errors in functions, which are used in the statusline.

Anyway, I'll shortly push the code fixing this issue.

from lightline.vim.

itchyny avatar itchyny commented on July 30, 2024

Note to me: after sourcing .vimrc, if the cool statusline disappears without error, change the statusline setting in the .vimrc

set statusline=...

to

if &statusline ==# ''
  set statusline=...
endif

Plus, letting g:lightline before syntax enable will fix all the problems.

  • call update in catch block in link function
  • do not overwrite the statusline in .vimrc
  • let g:lightline before syntax enable

Idea: watch CursorHold will make the second out of use.

from lightline.vim.

itchyny avatar itchyny commented on July 30, 2024

Simple idea: s:lightline

from lightline.vim.

itchyny avatar itchyny commented on July 30, 2024

I found the above simple idea will solve all the problems...

from lightline.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.