-- load standard vis module, providing parts of the Lua API require('vis') configdir = os.getenv("HOME") .. "/.config/vis/" vis.events.subscribe(vis.events.INIT, function() -- Your global configuration options -- generic commands for line in io.lines(configdir .. "commands.visrc") do vis:command(line) end -- Bindings local files = "normal,insert" -- needs a for (* in `{ls}){ for (io.lines) ... } local t for file in string.gmatch(files,"[^,]+") do for line in io.lines(configdir .. "Keybindings/" .. file) do if string.find(line,"^%g+%s+%g+") then -- ignores bad formats vis:map( vis.modes[string.upper(file)], line:match("^(%g+)%s+"), line:match("^%g+%s+(.+)$") ) end end end -- if your bindings get complicated, this is the way to go -- vis:command("map " .. file .. " " .. line) -- vis:map(vis.modes.NORMAL, "", "" ) end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- Your per window configuration options e.g. vis:command('set number') end)