Skip to content

Commit

Permalink
refactor!: separate setup config and theme init
Browse files Browse the repository at this point in the history
When loading plugin spec for other colorschemes they will apply user
options table but will not load the colorscheme when calling the
`require('plugin').setup()` function.

This mirrors that behaviour by separating config initialization and
loading of the colorschemes highlight definitions.

As a result users will be require explicitly call:
`colorscheme vscode` or `require('vscode').load()`
  • Loading branch information
daephx committed Mar 10, 2023
1 parent 3b53253 commit 7d3899b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion colors/vscode.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
local vscode = require('vscode')
vscode.setup({})
vscode.load()
8 changes: 6 additions & 2 deletions lua/vscode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ local vscode = {}
local config = require('vscode.config')
local theme = require('vscode.theme')

vscode.setup = function(user_opts)
config.setup(user_opts)
-- Pass setup to config module
vscode.setup = config.setup

-- Load colorscheme with a given or default style
---@param style? string
vscode.load = function()
vim.cmd('hi clear')
if vim.fn.exists('syntax_on') then
vim.cmd('syntax reset')
Expand Down

0 comments on commit 7d3899b

Please sign in to comment.