diff options
Diffstat (limited to 'autoload/shebang_create_exec.vim')
-rw-r--r-- | autoload/shebang_create_exec.vim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/autoload/shebang_create_exec.vim b/autoload/shebang_create_exec.vim index 60d2276..cfd08f5 100644 --- a/autoload/shebang_create_exec.vim +++ b/autoload/shebang_create_exec.vim @@ -30,10 +30,14 @@ function! s:Run(filename) abort return endif - " Check that it matches the file we just saved, and if so, make that file - " executable - if a:filename ==# b:shebang_create_exec_filename - call s:MakeExecutable(b:shebang_create_exec_filename) + " Get argument filename into local variable + let filename = a: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 " Clear away the save filename, even if we didn't change any permissions |