mirror of
https://github.com/rose-pine/neovim.git
synced 2025-10-15 12:38:53 +02:00
toggle from correct position
This commit is contained in:
parent
96785c8247
commit
8b4eeadc91
1 changed files with 14 additions and 9 deletions
|
|
@ -1,21 +1,26 @@
|
||||||
if vim.g.rose_pine_variant_switch == nil then
|
|
||||||
vim.g.rose_pine_variant_switch = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local select_variant = function(variant)
|
local select_variant = function(variant)
|
||||||
vim.g.rose_pine_variant = variant
|
vim.g.rose_pine_variant = variant
|
||||||
local formatted_variant = ""
|
local formatted_variant = ''
|
||||||
if variant == "base" then
|
if variant == 'base' then
|
||||||
formatted_variant = ""
|
formatted_variant = ''
|
||||||
else
|
else
|
||||||
formatted_variant = variant:sub(1, 1):upper() .. variant:sub(2)
|
formatted_variant = variant:sub(1, 1):upper() .. variant:sub(2)
|
||||||
end
|
end
|
||||||
print("Rosé Pine", formatted_variant)
|
print('Rosé Pine', formatted_variant)
|
||||||
vim.cmd([[colorscheme rose-pine]])
|
vim.cmd([[colorscheme rose-pine]])
|
||||||
end
|
end
|
||||||
|
|
||||||
local toggle_variant = function(variants)
|
local toggle_variant = function(variants)
|
||||||
local options = variants or { "base", "moon", "dawn" }
|
local options = variants or { 'base', 'moon', 'dawn' }
|
||||||
|
local index = {}
|
||||||
|
for k, v in pairs(options) do
|
||||||
|
index[v] = k
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.g.rose_pine_variant_switch == nil then
|
||||||
|
-- Ensure theme toggles from correct position
|
||||||
|
vim.g.rose_pine_variant_switch = index[vim.g.rose_pine_variant] or 0
|
||||||
|
end
|
||||||
|
|
||||||
vim.g.rose_pine_variant_switch = (vim.g.rose_pine_variant_switch % table.getn(options)) + 1
|
vim.g.rose_pine_variant_switch = (vim.g.rose_pine_variant_switch % table.getn(options)) + 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue