Skip to content

Commit

Permalink
refactor: option variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Dec 11, 2023
1 parent 9ba89b2 commit e067d68
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lua/spider/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ local patternVariants = require("lua.spider.pattern-variants")
---@field skipInsignificantPunctuation boolean
---@field subwordMovement boolean

local defaults = {
local defaultConfig = {
skipInsignificantPunctuation = true,
subwordMovement = true,
}
local config = defaults
local globalConfig = defaultConfig

---@param opts optsObj
function M.setup(opts) config = vim.tbl_deep_extend("force", config, opts) end
---@param userOpts optsObj
function M.setup(userOpts) globalConfig = vim.tbl_deep_extend("force", defaultConfig, userOpts) end

--------------------------------------------------------------------------------

Expand Down Expand Up @@ -103,10 +103,9 @@ end
--------------------------------------------------------------------------------

---@param key "w"|"e"|"b"|"ge" the motion to perform
---@param opts? optsObj configuration table as in setup()
function M.motion(key, opts)
-- merge global opts with opts passed for the specific call
opts = opts and vim.tbl_deep_extend("force", config, opts) or config
---@param motionOpts? optsObj configuration table as in setup()
function M.motion(key, motionOpts)
local opts = motionOpts and vim.tbl_deep_extend("force", globalConfig, motionOpts) or globalConfig

-- GUARD
if not (key == "w" or key == "e" or key == "b" or key == "ge") then
Expand Down

0 comments on commit e067d68

Please sign in to comment.