diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-29 02:37:30 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-29 02:37:30 +1200 |
commit | cd621073e171db746c6cba933a867a4f48329211 (patch) | |
tree | a25ab064d2f4fd9038e17176ecbea9c3de7a0fd4 /autoload | |
parent | First version (diff) | |
parent | Bump VERSION (diff) | |
download | vim-shebang-change-filetype-cd621073e171db746c6cba933a867a4f48329211.tar.gz vim-shebang-change-filetype-cd621073e171db746c6cba933a867a4f48329211.zip |
Merge branch 'release/v0.2.0'v0.2.0
* release/v0.2.0:
Condense and solidify documentation
Use :doautocmd to avoid redundancy
Correct indenting
Condense load guard
Split longish conditional
Remove unneeded function name
Replace unneeded regex check
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/shebang_change_filetype.vim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/autoload/shebang_change_filetype.vim b/autoload/shebang_change_filetype.vim index 081eaf1..447ac2b 100644 --- a/autoload/shebang_change_filetype.vim +++ b/autoload/shebang_change_filetype.vim @@ -1,7 +1,8 @@ " Check whether the first line was changed and looks like a shebang, and if " so, re-run filetype detection -function! shebang_change_filetype#Check() abort - if line('''[') == 1 && getline(1) =~# '^#!' +function! shebang_change_filetype#() abort + if line("'[") == 1 + \ && strpart(getline(1), 0, 2) ==# '#!' doautocmd filetypedetect BufRead endif endfunction |