0

I make a colorscheme plugin with vimscript (the code sucks, as I've never write a plugin before), there it checks if a global var exist or not.

" nvim-colors/colors/kalm.vim
...
if !exists('g:kalm_transparent_bg')
    let g:kalm_transparent_bg = 0
endif

if g:kalm_transparent_bg == 1
    hi Normal ctermbg=black ctermfg=white guifg=lightgray
else
    hi Normal ctermbg=black ctermfg=white guibg=#080a0c guifg=lightgray
endif
...

The problem is, it seems that this plugin got sourced first before my init.lua which contains the configuration line.

" $HOME/.config/init.lua
vim.cmd [[
    colorscheme kalm
    let g:kalm_transparent_bg = 1
]]

I checked it with --startuptime flag passed to neovim, here's the output:

...
004.238  000.456  000.456: sourcing /home/galih/.local/share/nvim/site/pack/vendor/start/nvim-colors/colors/kalm.vim
...
017.180  014.002  003.681: sourcing /home/username/.config/nvim/init.lua
...

I want so that I can write all the config option inside init.lua, and got it checked inside the plugin file easily. Do you have any idea about how to solve this?

1 Answer 1

1

The line

colorscheme kalm

Will source your colorscheme file. The color scheme is switched to immediately, this is a command not a setting.

let g:kalm_transparent_bg = 1
colorscheme kalm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.