vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

visrc.lua

(490B)


      1 vis.events = {}
      2 vis.events.win_open = function(win)
      3 	-- test.in file passed to vis
      4 	local in_file = win.file.name
      5 	if in_file then
      6 		-- use the corresponding test.cmd file
      7 		local cmd_file_name = string.gsub(in_file, '%.in$', '.cmd');
      8 		local cmd_file = io.open(cmd_file_name)
      9 		local cmd = cmd_file:read('*all')
     10 		vis:command(string.format(",{\n %s\n }", cmd))
     11 		local out_file_name = string.gsub(in_file, '%.in$', '.vis.out')
     12 		vis:command(string.format("w! %s", out_file_name))
     13 	end
     14 end