1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:20:06 +08:00

Fix python runner (#3304)

* Add func to split shebang to commands

* Fix python shebang check
This commit is contained in:
Wang Shidong 2020-01-26 21:17:24 +08:00 committed by GitHub
parent a145a86215
commit d1ba7d7cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,12 +146,17 @@ function! s:language_specified_mappings() abort
endfunction
function! s:Shebang_to_cmd(line) abort
let executable = matchstr(a:line, '#!\s*\zs[^ ]*')
let argvs = split(matchstr(a:line, '#!\s*[^ ]\+\s*\zs.*'))
return [executable] + argvs
endfunction
func! s:getexe() abort
let line = getline(1)
if line =~# '^#!'
let exe = split(line)
let exe[0] = exe[0][2:]
return exe
return s:Shebang_to_cmd(line)
endif
return ['python']
endf