Skip to content

Commit

Permalink
fix: handle plugin/ being loaded before setup() is called
Browse files Browse the repository at this point in the history
  • Loading branch information
jinh0 committed Jan 8, 2023
1 parent 9295480 commit 7c539e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 5 additions & 2 deletions fnl/eyeliner/config.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

(fn setup [user]
;; merged = union of default options and user's options
(let [merged (vim.tbl_deep_extend "force" {} opts (or user {}))]
(let [{: enabled : enable : disable} (require :eyeliner.main)
merged (vim.tbl_deep_extend "force" {} opts (or user {}))]
(if enabled (disable))
(set opts.highlight_on_key merged.highlight_on_key)
(set opts.debug merged.debug)))
(set opts.debug merged.debug)
(enable)))


{: setup : opts}
10 changes: 9 additions & 1 deletion lua/eyeliner/config.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
local opts = {debug = false, highlight_on_key = false}
local function setup(user)
local _let_1_ = require("eyeliner.main")
local enabled = _let_1_["enabled"]
local enable = _let_1_["enable"]
local disable = _let_1_["disable"]
local merged = vim.tbl_deep_extend("force", {}, opts, (user or {}))
if enabled then
disable()
else
end
opts.highlight_on_key = merged.highlight_on_key
opts.debug = merged.debug
return nil
return enable()
end
return {setup = setup, opts = opts}
2 changes: 1 addition & 1 deletion plugin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ vim.api.nvim_create_user_command('EyelinerEnable', function () require('eyeliner
vim.api.nvim_create_user_command('EyelinerDisable', function () require('eyeliner').disable() end, {})
vim.api.nvim_create_user_command('EyelinerToggle', function () require('eyeliner').toggle() end, {})

require('eyeliner').enable()
require('eyeliner').setup()

0 comments on commit 7c539e9

Please sign in to comment.