summaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/core/misc.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/lua/core/misc.lua b/lua/core/misc.lua
index 1f6d427..b96855b 100644
--- a/lua/core/misc.lua
+++ b/lua/core/misc.lua
@@ -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