aboutsummaryrefslogtreecommitdiffstats
path: root/init.lua
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-09-25 13:24:41 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-09-25 13:24:41 +0200
commit71ed2fb71d6e426ea7c0265eb27eecf520a2d04e (patch)
tree09b46bcc5e8d13e3907042d8b36ac25990b45b58 /init.lua
parentbd714ef8371c84689ea99717a04dbb1f076ed367 (diff)
downloadvis-open_rej-master.tar.gz
fix: don't vendor file_exists functionHEADmaster
Depends on https://git.sr.ht/~mcepl/vis/log/vis-file_exists
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua11
1 files changed, 1 insertions, 10 deletions
diff --git a/init.lua b/init.lua
index a32f753..7d3dad7 100644
--- a/init.lua
+++ b/init.lua
@@ -1,14 +1,5 @@
local internal_open = false
-local function file_exists(path)
- local f = io.open(path)
- local out = f ~= nil
- if out then
- io.close(f)
- end
- return out
-end
-
local function open_other_file(file)
local other = ""
if file then
@@ -19,7 +10,7 @@ local function open_other_file(file)
-- open rejected hunks file
other = file .. '.rej'
end
- if file_exists(other) then
+ if vis:file_exists(other) then
internal_open = true
vis:command('open ' .. other)
end