Skip to content

Commit

Permalink
renamed 'save_dir_path' to 'save_file'
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitriosvalodimos committed Sep 30, 2023
1 parent 7cf4ddf commit 8c258f9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
chameleon.nvim

Theme switcher for neovim

---

# Setup

The setup is admittedly a little bit involved.

- specify your themes first (example using lazy):
```lua
{
{ "repo1/theme1", lazy = false, priority = 1000 }
{ "repo2/theme2", lazy = false, priority = 1000 }
{ "repo3/theme3", lazy = false, priority = 1000 }
}
```

-
10 changes: 5 additions & 5 deletions lua/chameleon/config.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local _setup = {}

local function normalize_path()
if not _setup.save_dir_path then
if not _setup.save_path then
return
end

_setup.save_dir_path = vim.fn.fnamemodify(_setup.save_dir_path, ":p")
_setup.save_path = vim.fn.fnamemodify(_setup.save_path, ":p")
end

local function normalize_setup()
Expand Down Expand Up @@ -39,8 +39,8 @@ local function get_config()
return _setup
end

local function save_dir_enabled()
return _setup.save_dir_path ~= nil
local function save_path_enabled()
return _setup.save_path ~= nil
end

local function name_to_config(theme_name)
Expand All @@ -56,7 +56,7 @@ return {
setup = setup,
normalize_path = normalize_path,
normalize_setup = normalize_setup,
save_dir_enabled = save_dir_enabled,
save_path_enabled = save_path_enabled,
get_config = get_config,
name_to_config = name_to_config,
}
2 changes: 1 addition & 1 deletion lua/chameleon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local switch = function(opts)
end
end

if config.save_dir_enabled() then
if config.save_path_enabled() then
loader.save(opts)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lua/chameleon/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local config = require("chameleon.config")

local function save(theme_name)
local theme_config = config.name_to_config(theme_name)
local save_path = config.get_config().save_dir_path
local save_path = config.get_config().save_path

local file = io.open(save_path, "r")
if file == nil then
Expand Down Expand Up @@ -36,7 +36,7 @@ local function save(theme_name)
end

local function restore()
local save_path = config.get_config().save_dir_path
local save_path = config.get_config().save_path
local saved_config = dofile(save_path)

if not saved_config.colorscheme then
Expand Down

0 comments on commit 8c258f9

Please sign in to comment.