aboutsummaryrefslogtreecommitdiff
path: root/autoload/shebang_create_exec.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-29 01:37:48 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-29 01:37:48 +1200
commit980f96002ed6eaf548d31ac4aca57486fc1a308b (patch)
tree052b0b6b47341ea91400631e2bd588f9fdf80058 /autoload/shebang_create_exec.vim
parentMerge branch 'hotfix/v1.0.1' (diff)
parentBump VERSION (diff)
downloadvim-shebang-create-exec-master.tar.gz
vim-shebang-create-exec-master.zip
Merge branch 'release/v1.1.0'HEADv1.1.0master
* release/v1.1.0: Add file existence check before making executable Use local variable for filename and readability
Diffstat (limited to 'autoload/shebang_create_exec.vim')
-rw-r--r--autoload/shebang_create_exec.vim12
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