Skip to content

Commit

Permalink
fix(config): convert static values to dynamic functions
Browse files Browse the repository at this point in the history
- Modified "host" and "user" to use function calls
- Updated "gh-email" and "gh-user" to use function calls
- These changes ensure that the values are always up-to-date when
  accessed, rather than being set once at initialization
- This reduces startuptime of plugin from ~30ms to ~3ms (10x
  improvement)
  • Loading branch information
cvigilv committed Sep 11, 2024
1 parent 53da211 commit a35c2d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/esqueleto/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ M.default_config = {
["time"] = function() return os.date("%T", os.time()) end,

-- System
["host"] = utils.capture("hostname", false),
["user"] = os.getenv("USER"),
["host"] = function() return utils.capture("hostname", false) end,
["user"] = function() return os.getenv("USER") end,

-- Github
["gh-email"] = utils.capture("git config user.email", false),
["gh-user"] = utils.capture("git config user.name", false),
["gh-email"] = function() return utils.capture("git config user.email", false) end,
["gh-user"] = function() return utils.capture("git config user.name", false) end,
},
},
advanced = {
Expand Down

0 comments on commit a35c2d1

Please sign in to comment.