Set makeprg if pip-compile is available

also update tests and make Requirements_matched_filename more specific.
This commit is contained in:
Eric Nielsen
2021-03-18 13:38:21 -05:00
parent a86fea904d
commit 82d0dcdb33
3 changed files with 21 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
if executable('pip-compile')
let s:filename = expand("%:p")
if fnamemodify(s:filename, ":t") ==# 'requirements.in'
" this is the default filename for pip-compile
setlocal makeprg=pip-compile
elseif fnamemodify(s:filename, ":e") ==# 'in'
\ && Requirements_matched_filename(s:filename)
setlocal makeprg=pip-compile\ %
endif
endif
" vim: et sw=4 ts=4 sts=4: