From 3ad297db5c1cf94660e4297ffa81b6281eab2884 Mon Sep 17 00:00:00 2001 From: Chayoung You Date: Wed, 30 Sep 2020 18:20:29 +0900 Subject: Fix error when editing path for shebang (#572) --- autoload/polyglot/shebang.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'autoload') 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) -- cgit v1.2.3