Browse Source

add file exists function

Chris 4 years ago
parent
commit
2890ce665e
1 changed files with 4 additions and 0 deletions
  1. 4 0
      lua/nv-utils/init.lua

+ 4 - 0
lua/nv-utils/init.lua

@@ -195,6 +195,10 @@ function nv_utils.blame_line()
 end
 
 -- misc
+function nv_utils.file_exists(name)
+   local f=io.open(name,"r")
+   if f~=nil then io.close(f) return true else return false end
+end
 
 -- autoformat
 -- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)