1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

update make_tasks example to support Makefiles with multiple .PHONY options (#4337)

This commit is contained in:
Jozsef Lazar 2021-07-19 14:53:12 +02:00 committed by GitHub
parent 3f3a4912df
commit af8e26af86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

@ -2073,10 +2073,10 @@ SpaceVim 目前支持自动识别以下构建系统的任务npm。
```vim
function! s:make_tasks() abort
if filereadable('Makefile')
let subcmd = filter(readfile('Makefile', ''), "v:val=~#'^.PHONY'")
if !empty(subcmd)
let commands = split(subcmd[0])[1:]
let conf = {}
let subcmds = filter(readfile('Makefile', ''), "v:val=~#'^.PHONY'")
let conf = {}
for subcmd in subcmds
let commands = split(subcmd)[1:]
for cmd in commands
call extend(conf, {
\ cmd : {
@ -2087,10 +2087,8 @@ function! s:make_tasks() abort
\ }
\ })
endfor
return conf
else
return {}
endif
endfor
return conf
else
return {}
endif

View File

@ -2138,10 +2138,10 @@ here is an example for building a task provider.
```vim
function! s:make_tasks() abort
if filereadable('Makefile')
let subcmd = filter(readfile('Makefile', ''), "v:val=~#'^.PHONY'")
if !empty(subcmd)
let commands = split(subcmd[0])[1:]
let conf = {}
let subcmds = filter(readfile('Makefile', ''), "v:val=~#'^.PHONY'")
let conf = {}
for subcmd in subcmds
let commands = split(subcmd)[1:]
for cmd in commands
call extend(conf, {
\ cmd : {
@ -2152,10 +2152,8 @@ function! s:make_tasks() abort
\ }
\ })
endfor
return conf
else
return {}
endif
endfor
return conf
else
return {}
endif