aboutsummaryrefslogtreecommitdiffstats
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..85f3e8d
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,22 @@
+function file_exists(name)
+ local f=io.open(name,"r")
+ if f~=nil then
+ io.close(f)
+ return true
+ else
+ return false
+ end
+end
+
+function open_rej_file()
+ local win = vis.win
+ local file = win.file
+ local rejfile = file.path .. '.rej'
+ if file_exists(rejfile) then
+ vis:command('ed ' .. rejfile)
+ end
+end
+
+vis.events.subscribe(vis.events.FILE_OPEN, function (file)
+ open_rej_file(file.path)
+end)