aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-05 11:01:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-05 11:01:59 +1200
commit2ba8ba9d035f3071ae03b9929d2b6cfde4b0f6db (patch)
treef2a774238e7fa37bae62e5c9eb37e4a3ee46a49a /vim/plugin
parentFuture-proof README.md discussion of Vim plugins (diff)
downloaddotfiles-2ba8ba9d035f3071ae03b9929d2b6cfde4b0f6db.tar.gz
dotfiles-2ba8ba9d035f3071ae03b9929d2b6cfde4b0f6db.zip
Add shebang_update.vim plugin
This plugin updates the filetype after every insert operation that changes the first line. No documentation yet.
Diffstat (limited to 'vim/plugin')
-rw-r--r--vim/plugin/shebang_update.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/vim/plugin/shebang_update.vim b/vim/plugin/shebang_update.vim
new file mode 100644
index 00000000..1dbcaf67
--- /dev/null
+++ b/vim/plugin/shebang_update.vim
@@ -0,0 +1,20 @@
+"
+" shabeng_update.vim: If the first line of a file was changed, re-run
+" scripts.vim to do shebang detection to update the filetype.
+"
+" Author: Tom Ryder <tom@sanctum.geek.nz>
+" License: Same as Vim itself
+"
+if exists('g:loaded_shebang_update') || &compatible
+ finish
+endif
+if v:version < 700
+ finish
+endif
+let g:loaded_shebang_update = 1
+
+" Call the update function whenever leaving insert mode
+augroup shebang_update
+ autocmd!
+ autocmd InsertLeave * call shebang#Update()
+augroup END