make replaceword safer
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user