Set makeprg if pip-compile is available

also update tests and make Requirements_matched_filename more specific.
This commit is contained in:
Eric Nielsen committed 2021-03-18 14:49:09 -05:00
1 parent a86fea904d
commit 82d0dcdb33
3 files changed
+21 -3

No files matched your search

+11
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: