Skip to content

Commit 3ad297d

Browse files
authored
Fix error when editing path for shebang (#572)
1 parent 5d7121d commit 3ad297d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoload/polyglot/shebang.vim

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ func! s:Filetype()
3030

3131
let [_, l:path, l:rest; __] = l:pathrest
3232

33-
let l:script = split(l:path, "/")[-1]
33+
let l:pathparts = split(l:path, "/")
34+
35+
if len(l:pathparts) == 0
36+
return
37+
endif
38+
39+
let l:script = l:pathparts[-1]
3440

3541
if l:script == "env"
3642
let l:argspath = matchlist(l:rest, s:r_env)

0 commit comments

Comments
 (0)