-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Setup and configuration now requires using the `setup` function
- Loading branch information
1 parent
53713a9
commit cc6964d
Showing
10 changed files
with
125 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,67 @@ | ||
---@class Config | ||
local config | ||
|
||
local vimConfig = false | ||
|
||
-- shim vim for kitty and other generators | ||
vim = vim or { g = {}, o = {} } | ||
vim = vim or {g = {}, o = {}} | ||
|
||
local function opt(key, default) | ||
key = "onedark_" .. key | ||
if vim.g[key] == nil then | ||
return default | ||
else | ||
vimConfig = true | ||
if vim.g[key] == 0 then | ||
return false | ||
else | ||
return vim.g[key] | ||
end | ||
end | ||
if vim.g[key] == 0 then | ||
return false | ||
end | ||
return vim.g[key] | ||
end | ||
|
||
local g = { | ||
transparent = "onedark_transparent", | ||
commentStyle = "onedark_italic_comments", | ||
keywordStyle = "onedark_italic_keywords", | ||
functionStyle = "onedark_italic_functions", | ||
variableStyle = "onedark_italic_variables", | ||
hideInactiveStatusline = "onedark_hide_inactive_statusline", | ||
sidebars = "onedark_sidebars", | ||
colors = "onedark_colors", | ||
dev = "onedark_dev", | ||
hideNonText = "onedark_hide_nontext", | ||
darkFloat = "onedark_dark_float", | ||
darkSidebar = "onedark_dark_sidebar" | ||
} | ||
|
||
config = { | ||
transparent = opt("transparent", false), | ||
commentStyle = opt("italic_comments", true) and "italic" or "NONE", | ||
keywordStyle = opt("italic_keywords", true) and "italic" or "NONE", | ||
functionStyle = opt("italic_functions", false) and "italic" or "NONE", | ||
variableStyle = opt("italic_variables", false) and "italic" or "NONE", | ||
hideInactiveStatusline = opt("hide_inactive_statusline", false), | ||
hideNonText = opt("hide_nontext", true), | ||
sidebars = opt("sidebars", {}), | ||
colors = opt("colors", {}), | ||
dev = opt("dev", false), | ||
darkFloat = opt("dark_float", true), | ||
darkSidebar = opt("dark_sidebar", true), | ||
transform_colors = false, | ||
transparent = opt(g.transparent, false), | ||
commentStyle = opt(g.commentStyle, true) and "italic" or "NONE", | ||
keywordStyle = opt(g.keywordStyle, true) and "italic" or "NONE", | ||
functionStyle = opt(g.functionStyle, false) and "italic" or "NONE", | ||
variableStyle = opt(g.variableStyle, false) and "italic" or "NONE", | ||
hideInactiveStatusline = opt(g.hideInactiveStatusline, false), | ||
sidebars = opt(g.sidebars, {}), | ||
colors = opt(g.colors, {}), | ||
dev = opt(g.dev, false), | ||
hideNonText = opt(g.hideNonText, true), | ||
darkFloat = opt(g.darkFloat, true), | ||
darkSidebar = opt(g.darkSidebar, true), | ||
transform_colors = false | ||
} | ||
|
||
return config | ||
---@param userConfig Config | ||
local function applyConfiguration(userConfig) | ||
for key, value in pairs(userConfig) do | ||
if value ~= nil then | ||
if config[key] ~= nil then | ||
config[key] = value | ||
else | ||
error("monsonjeremy/onedark: Option " .. key .. " does not exist") -- luacheck: ignore | ||
end | ||
end | ||
end | ||
end | ||
|
||
return {config = config, vimConfig = vimConfig, applyConfiguration = applyConfiguration} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
local util = require("onedark.util") | ||
local theme = require("onedark.theme") | ||
local configModule = require("onedark.config") | ||
|
||
local M = {} | ||
local function setup(userConfig) | ||
-- Applying user configuration | ||
if userConfig then configModule.applyConfiguration(userConfig) end | ||
|
||
function M.colorscheme() | ||
util.load(theme.setup()) | ||
-- Load colorscheme | ||
util.load(theme.setup(configModule.config)) | ||
end | ||
|
||
return M | ||
return {setup = setup} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters