make replaceword safer
This commit is contained in:
parent
985b065925
commit
3ebe12e99d
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue