diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2020-05-07 11:40:32 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2020-05-07 11:40:32 +0200 |
commit | 04861fba1f56142b9d2ecf7998e2f29a199db9b8 (patch) | |
tree | 5063c0c35b55edb1994fc947717e9ec45ea6d62d | |
parent | 22ede815470136dd14892df968c7f6dae8a79983 (diff) | |
download | vis-open_rej-04861fba1f56142b9d2ecf7998e2f29a199db9b8.tar.gz |
First attempt
-rw-r--r-- | init.lua | 22 |
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) |