Skip to content

Commit

Permalink
Correct indentation in :lua command
Browse files Browse the repository at this point in the history
  • Loading branch information
taobert authored and aidanholm committed Jan 23, 2023
1 parent 68e4ffc commit b3be1f8
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions lib/binds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -532,27 +532,27 @@ modes.add_cmds({
end },

{ ":lua", "Evaluate Lua snippet.", function (w, o)
local a = o.arg
if a then
-- Parse as expression first, then statement
-- With this order an error message won't contain the print() wrapper
local ret, err = loadstring("print(" .. a .. ")", "lua-cmd")
if err then
ret, err = loadstring(a, "lua-cmd")
end
if err then
w:error(err)
else
setfenv(ret, setmetatable({}, { __index = function (_, k)
if _G[k] ~= nil then return _G[k] end
if k == "w" then return w end
if package.loaded[k] then return package.loaded[k] end
end, __newindex = _G }))
ret()
end
else
w:set_mode("lua")
end
local a = o.arg
if a then
-- Parse as expression first, then statement
-- With this order an error message won't contain the print() wrapper
local ret, err = loadstring("print(" .. a .. ")", "lua-cmd")
if err then
ret, err = loadstring(a, "lua-cmd")
end
if err then
w:error(err)
else
setfenv(ret, setmetatable({}, { __index = function (_, k)
if _G[k] ~= nil then return _G[k] end
if k == "w" then return w end
if package.loaded[k] then return package.loaded[k] end
end, __newindex = _G }))
ret()
end
else
w:set_mode("lua")
end
end },

{ ":dump", "Dump current tabs html to file.",
Expand Down

0 comments on commit b3be1f8

Please sign in to comment.