Skip to content

Commit 268ec62

Browse files
committed
fix!: remove auto-apply from setup() to match standard convention
BREAKING CHANGE: setup() no longer automatically applies the theme. Users must now call vim.cmd.colorscheme('oasis') after setup(). This aligns Oasis with the standard pattern used by other popular colorscheme plugins (Catppuccin, Tokyonight, etc.) where setup() only configures and :colorscheme applies the theme. Updated all documentation examples to show the two-step pattern: - Installation section - Auto-switching configuration - Palette overrides - Highlight overrides - Usage section with clearer headers Fixes the issue where setup() would override explicit colorscheme choices, preventing users from configuring Oasis features (like auto-switching) without forcing it as their active colorscheme.
1 parent ba0eb28 commit 268ec62

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ Install the theme with your preferred package manager, such as
150150
require('oasis').setup({
151151
style = "lagoon", -- Optional: Choose any style like `lagoon` or 'dune'.
152152
})
153+
vim.cmd.colorscheme('oasis') -- Apply the theme
153154
end
154155
}
155156
```
@@ -196,6 +197,7 @@ require('oasis').setup({
196197
dark_style = "lagoon", -- Style when background is dark
197198
light_style = "dawn" -- Style when background is light
198199
})
200+
vim.cmd.colorscheme('oasis') -- Apply the theme
199201
```
200202

201203
</details>
@@ -236,6 +238,7 @@ require('oasis').setup({
236238
}
237239
}
238240
})
241+
vim.cmd.colorscheme('oasis') -- Apply the theme
239242
```
240243

241244
</details>
@@ -254,23 +257,34 @@ require('oasis').setup({
254257
Identifier = "Function" -- Link to another group
255258
}
256259
})
260+
vim.cmd.colorscheme('oasis') -- Apply the theme
257261
```
258262

259263
</details>
260264

261265
## 🚀 Usage
262266

263-
### ⭐ Recommended: Use `setup()` to launch nvim with your desired style
267+
### ⭐ Configuration and Application
268+
269+
First, call `setup()` to configure Oasis, then apply the theme with `:colorscheme`:
264270

265271
```lua
266-
-- Use default style (lagoon)
272+
-- Use default style
267273
require('oasis').setup()
274+
vim.cmd.colorscheme('oasis')
268275

269-
-- Or specify a style
276+
-- Or specify just one style
270277
require('oasis').setup({ style = "desert" })
278+
vim.cmd.colorscheme('oasis')
279+
280+
-- Or choose dark / light styles (based on background)
281+
require('oasis').setup({ dark_style = "sol", light_style = "dawn" })
282+
vim.cmd.colorscheme('oasis')
271283
```
272284

273-
### Alternative: Use `colorscheme` command to swap on the fly
285+
### Switching Styles On The Fly
286+
287+
After setup, use the `:colorscheme` command to swap between styles:
274288

275289
```lua
276290
vim.cmd.colorscheme("oasis") -- default (lagoon)

lua/oasis/init.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function M.is_manual_bg_change(new_value)
1313
return expected_background_value == new_value
1414
end
1515

16-
--- Setup Oasis with user configuration and apply the theme
16+
--- Setup Oasis with user configuration
17+
--- Note: This only configures Oasis. To apply the theme, use :colorscheme oasis
1718
--- Examples:
1819
--- require('oasis').setup({
1920
--- style = "lagoon", -- Shorthand for "oasis_lagoon"
@@ -23,10 +24,10 @@ end
2324
--- palette_overrides = { oasis_desert = { syntax = { comment = "#87CEEB" } } },
2425
--- highlight_overrides = { Comment = { fg = "#AABBCC" } }
2526
--- })
27+
--- vim.cmd.colorscheme('oasis') -- Apply the theme
2628
---@param user_config table|nil User configuration
2729
function M.setup(user_config)
2830
config.setup(user_config)
29-
M.apply()
3031
end
3132

3233
--- Apply Oasis using a palette module name (no prefix).

0 commit comments

Comments
 (0)