local M = {} M.appid = "Nvim Config" function M.colorscheme(name) vim.cmd('colorscheme '..name) for k, v in pairs(vim.fn.getcompletion('', 'color')) do if v == name..'.ext' then vim.cmd('colorscheme '..name..'.ext') end end end function M.replaceword(old, new) local conf = vim.fn.stdpath("config").."/lua/conf/".."opts.lua" local f = io.open(conf, "r") local new_content = f:read("*all"):gsub(old, new) f = io.open(conf, "w") f:write(new_content) f:close() end function M.include(fn) if not pcall(require, fn) then vim.notify('Could not find "'..fn, vim.log.levels.WARN..'"', { title = M.appid }) end end function M.readf(fn) local f = io.open(fn, "r") if not f then return nil end local tab = {} for l in f:lines() do table.insert(tab, l) end return tab end return M