Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
💝 Tidy vimConfig set
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Jun 20, 2021
1 parent 99003ad commit 29afc27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
13 changes: 8 additions & 5 deletions lua/onedark/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ vim = vim or {g = {}, o = {}}

local function opt(key, default)
key = "onedark_" .. key
if vim.g[key] == nil then return default end
if vim.g[key] == 0 then
if vim.g[key] == nil then
return default
else
vimConfig = true
return false
if vim.g[key] == 0 then
return false
else
return vim.g[key]
end
end
vimConfig = true
return vim.g[key]
end

config = {
Expand Down
11 changes: 7 additions & 4 deletions lua/onedark/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ local theme = require("onedark.theme")
local configModule = require("onedark.config")

local function setup(userConfig)
if userConfig then
configModule.applyConfiguration(userConfig)
elseif configModule.vimConfig then
-- Warning, If config set inside 'vim.g'
if configModule.vimConfig then
vim.schedule(function()
vim.api.nvim_err_writeln(
[[ful1e5/onedark: onedark will stop supporting vimscript soon, change your config to lua or wrap it around lua << EOF ... EOF]]) -- luacheck: ignore
end)
end

-- Applying user configuration
if userConfig then configModule.applyConfiguration(userConfig) end

-- Load colorscheme
util.load(theme.setup(configModule.config))
vim.cmd [[colorscheme onedark]]
end

return {setup = setup}

0 comments on commit 29afc27

Please sign in to comment.