make replaceword safer

This commit is contained in:
2024-04-19 22:32:17 -04:00
parent c11d42a1cb
commit 058379b907

View File

@ -14,9 +14,12 @@ end
function M.replaceword(old, new)
local conf = vim.fn.stdpath("config").."/lua/conf/".."opts.lua"
local f = io.open(conf, "r")
if not f then return end
local new_content = f:read("*all"):gsub(old, new)
f:close()
f = io.open(conf, "w")
if not f then return end
f:write(new_content)
f:close()
end