aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/shebang_create_exec.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-18 10:14:59 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-18 10:14:59 +1200
commit091dd758d03098ed5e291274fa1a5e6bef4f16a2 (patch)
tree273dd0a135f6a581485340768656994643b5da3b /vim/plugin/shebang_create_exec.vim
parentMerge branch 'release/v1.33.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-091dd758d03098ed5e291274fa1a5e6bef4f16a2.tar.gz
dotfiles-091dd758d03098ed5e291274fa1a5e6bef4f16a2.zip
Merge branch 'release/v1.34.0'v1.34.0
* release/v1.34.0: Bump VERSION Scrap auto_cache_dirs plugin for a new approach Check b:is_posix existence not value Spin shebang_create_exec.vim into own distribution Adjust formatting of .gitmodules Separate shebang_create_exec into autoload funcs
Diffstat (limited to 'vim/plugin/shebang_create_exec.vim')
-rw-r--r--vim/plugin/shebang_create_exec.vim35
1 files changed, 0 insertions, 35 deletions
diff --git a/vim/plugin/shebang_create_exec.vim b/vim/plugin/shebang_create_exec.vim
deleted file mode 100644
index 7fabd8f7..00000000
--- a/vim/plugin/shebang_create_exec.vim
+++ /dev/null
@@ -1,35 +0,0 @@
-"
-" shebang_create_exec.vim: Make a file executable on first save if it starts with a
-" shebang.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_shebang_create_exec') || &compatible
- finish
-endif
-if !has('autocmd') || !has('unix') || !exists('*shellescape')
- finish
-endif
-let g:loaded_shebang_create_exec = 1
-
-" Set up hook for before writes to check the buffer for new shebangs
-augroup shebang_create_exec
- autocmd!
- autocmd BufWritePre * call s:Check(expand('<afile>:p'))
-augroup END
-
-" If the buffer starts with a shebang and the file being saved to doesn't
-" exist yet, set up a hook to make it executable after the write is done
-function! s:Check(filename) abort
- if stridx(getline(1), '#!') == 0 && !filereadable(a:filename)
- autocmd shebang_create_exec BufWritePost <buffer>
- \ call s:Chmod(expand('<afile>:p'))
- endif
-endfunction
-
-" Make the file executable and clear away the hook that called us
-function! s:Chmod(filename) abort
- autocmd! shebang_create_exec BufWritePost <buffer>
- call system('chmod +x '.shellescape(a:filename))
-endfunction