summaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/polyglot/shebang.vim8
1 files changed, 7 insertions, 1 deletions
diff --git a/autoload/polyglot/shebang.vim b/autoload/polyglot/shebang.vim
index 72c56f6f..66ccacd6 100644
--- a/autoload/polyglot/shebang.vim
+++ b/autoload/polyglot/shebang.vim
@@ -30,7 +30,13 @@ func! s:Filetype()
let [_, l:path, l:rest; __] = l:pathrest
- let l:script = split(l:path, "/")[-1]
+ let l:pathparts = split(l:path, "/")
+
+ if len(l:pathparts) == 0
+ return
+ endif
+
+ let l:script = l:pathparts[-1]
if l:script == "env"
let l:argspath = matchlist(l:rest, s:r_env)