summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChayoung You <yousbe@gmail.com>2020-09-30 18:20:29 +0900
committerGitHub <noreply@github.com>2020-09-30 11:20:29 +0200
commit3ad297db5c1cf94660e4297ffa81b6281eab2884 (patch)
tree6bc651879a7126f5122f4a3083a7a60abfba517a
parent5d7121d8290fa0b61e7cb4ab3ece3105af664b30 (diff)
downloadvim-polyglot-3ad297db5c1cf94660e4297ffa81b6281eab2884.tar.gz
vim-polyglot-3ad297db5c1cf94660e4297ffa81b6281eab2884.zip
Fix error when editing path for shebang (#572)
-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)