aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-29 01:37:13 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-29 01:37:13 +1200
commit65f78c06cadf53eb68b1e06cf62cf01a99fa302b (patch)
tree90719b541748d52b54ff957a5bc0de6aacb974a5
parentc68ed594820582bf48d16358b618b64d2ec94460 (diff)
downloadvim-shebang-create-exec-65f78c06cadf53eb68b1e06cf62cf01a99fa302b.tar.gz
vim-shebang-create-exec-65f78c06cadf53eb68b1e06cf62cf01a99fa302b.zip
Add file existence check before making executable
-rw-r--r--autoload/shebang_create_exec.vim7
1 files changed, 4 insertions, 3 deletions
diff --git a/autoload/shebang_create_exec.vim b/autoload/shebang_create_exec.vim
index 60e24a6..cfd08f5 100644
--- a/autoload/shebang_create_exec.vim
+++ b/autoload/shebang_create_exec.vim
@@ -33,9 +33,10 @@ function! s:Run(filename) abort
" Get argument filename into local variable
let filename = a:filename
- " Check that it matches the file we just saved, and if so, make that file
- " executable
- if l:filename ==# b:shebang_create_exec_filename
+ " Check that it matches the file we just saved, and that the file exists,
+ " and if so, attempt to make it executable
+ if filename ==# b:shebang_create_exec_filename
+ \ && filereadable(filename)
call s:MakeExecutable(filename)
endif