diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | vim/autoload/shebang_create_exec.vim | 14 | ||||
m--------- | vim/bundle/shebang_create_exec | 0 | ||||
-rw-r--r-- | vim/plugin/shebang_create_exec.vim | 21 |
4 files changed, 3 insertions, 35 deletions
diff --git a/.gitmodules b/.gitmodules index 976d02fa..bad6f54b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -32,6 +32,9 @@ [submodule "vim/bundle/redact_pass"] path = vim/bundle/redact_pass url = https://sanctum.geek.nz/code/vim-redact-pass.git +[submodule "vim/bundle/shebang_create_exec"] + path = vim/bundle/shebang_create_exec + url = https://sanctum.geek.nz/code/vim-shebang-create-exec.git [submodule "vim/bundle/strip_trailing_whitespace"] path = vim/bundle/strip_trailing_whitespace url = https://sanctum.geek.nz/code/vim-strip-trailing-whitespace.git diff --git a/vim/autoload/shebang_create_exec.vim b/vim/autoload/shebang_create_exec.vim deleted file mode 100644 index b01cf584..00000000 --- a/vim/autoload/shebang_create_exec.vim +++ /dev/null @@ -1,14 +0,0 @@ -" 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! shebang_create_exec#Check(filename) abort - if stridx(getline(1), '#!') == 0 && !filereadable(a:filename) - autocmd shebang_create_exec BufWritePost <buffer> - \ call shebang_create_exec#Chmod(expand('<afile>:p')) - endif -endfunction - -" Make the file executable and clear away the hook that called us -function! shebang_create_exec#Chmod(filename) abort - autocmd! shebang_create_exec BufWritePost <buffer> - call system('chmod +x '.shellescape(a:filename)) -endfunction diff --git a/vim/bundle/shebang_create_exec b/vim/bundle/shebang_create_exec new file mode 160000 +Subproject 9adbf4f7e575fe8bbcfb2e1b2b6cd34bf42140a diff --git a/vim/plugin/shebang_create_exec.vim b/vim/plugin/shebang_create_exec.vim deleted file mode 100644 index 401a23b8..00000000 --- a/vim/plugin/shebang_create_exec.vim +++ /dev/null @@ -1,21 +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 shebang_create_exec#Check(expand('<afile>:p')) -augroup END |