raddari / last-color.nvim

Remember your last call to :colorscheme between restarts
GNU General Public License v3.0
17 stars 2 forks source link

Crash if no color is defined #10

Closed raffaem closed 5 months ago

raffaem commented 5 months ago

Run

rm -rf ~/.local/share/nvim

Start nvim

Loading the plugin will fail until you select a colorscheme:

Failed to source `/home/raffaele/.config/nvim/after/plugin/last-color.lua`

vim/_editor.lua:0: /home/raffaele/.config/nvim/init.lua..nvim_exec2() called at /home/raffaele/.config/nvim/init.lua:0../home/raffaele/.config/nvim/after/plugin/last-color.lua: Vim(source):E5113: Error while calling lua chunk: vim/_editor.lua:0: /home/raffaele/.config/nvim/init.lua..nvim_exec2() called at /home/raffaele/.config/nvim/init.lua:0../home/raffaele/.config/nvim/after/plugin/last-color.lua..nvim_exec2() called at /home/raffaele/.config/nvim/after/plugin/last-color.lua:0: Vim(colorscheme):E185: Cannot find color scheme 'kanagawa'
stack traceback:
    [C]: in function 'nvim_exec2'
    vim/_editor.lua: in function 'cmd'
    /home/raffaele/.config/nvim/after/plugin/last-color.lua:3: in main chunk
    [C]: in function 'nvim_exec2'
    vim/_editor.lua: in function 'cmd'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484>
    [C]: in function 'xpcall'
    .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:144: in function 'startup'
    ...faele/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
    /home/raffaele/.config/nvim/init.lua:203: in main chunk

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/.config/nvim/init.lua:203
raddari commented 5 months ago

I noticed your error output says "cannot find color scheme 'kanagawa'".

Are you using the snippet in the readme by any chance? 'kanagawa' doesn't come with neovim (I should have chosen a better example, my bad), so you should replace it with the color scheme you want to load as a fallback :)

raffaem commented 5 months ago

Completely forgot that.

Maybe use vim as backup?