diff options
author | Chayoung You <yousbe@gmail.com> | 2020-09-30 18:20:29 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-30 11:20:29 +0200 |
commit | 3ad297db5c1cf94660e4297ffa81b6281eab2884 (patch) | |
tree | 6bc651879a7126f5122f4a3083a7a60abfba517a | |
parent | 5d7121d8290fa0b61e7cb4ab3ece3105af664b30 (diff) | |
download | vim-polyglot-3ad297db5c1cf94660e4297ffa81b6281eab2884.tar.gz vim-polyglot-3ad297db5c1cf94660e4297ffa81b6281eab2884.zip |
Fix error when editing path for shebang (#572)
-rw-r--r-- | autoload/polyglot/shebang.vim | 8 |
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) |