diff --git a/README.md b/README.md index 630dcdc..a14051f 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,10 @@ To try the build file in the current directory before searching from the file di let g:makeshift_use_pwd_first = 1 +To enable search for bundled build program/script: + + let g:makeshift_find_bundled = 1 + Build Systems ------------- @@ -116,6 +120,7 @@ Makeshift currently associates the following files with their build systems: * mix.exs: mix * pom.xml: mvn * build.ninja: ninja + * wscript: waf Adding a new build system ------------------------- diff --git a/doc/makeshift.txt b/doc/makeshift.txt index d8b754e..3f65473 100644 --- a/doc/makeshift.txt +++ b/doc/makeshift.txt @@ -95,10 +95,16 @@ To automatically change directory to 'b:makeshift_root' when it is discovered: *'makeshift_use_pwd_first'* To try the build file in the current directory before searching from the file -directory: -> +directory: > + let g:makeshift_use_pwd_first = 1 < + *'makeshift_find_bundled'* + +To enable search for bundled build program/script: > + + let g:makeshift_find_bundled = 1 + ============================================================================== BUILD SYSTEMS *makeshift-systems* @@ -113,6 +119,8 @@ Makeshift currently associates the following files with their build systems: * build.xml: ant * mix.exs: mix * pom.xml: mvn + * build.ninja: ninja + * wscript: waf ============================================================================== @@ -124,7 +132,7 @@ If Makeshift doesn't already know about your build system, or you wish to override the default program for a given file, you can define a dictionary, which has filenames as keys and corresponding programs as values. > let g:makeshift_systems = { - \'build.ninja ': 'ninja', + \'build.sbt ': 'sbt', \} < diff --git a/plugin/makeshift.vim b/plugin/makeshift.vim index a92bcc2..ca5a59e 100644 --- a/plugin/makeshift.vim +++ b/plugin/makeshift.vim @@ -19,6 +19,7 @@ function! s:build_defaults() \'mix.exs': 'mix', \'pom.xml': 'mvn', \'build.ninja': 'ninja', + \'wscript': 'waf', \} endfunction @@ -57,9 +58,21 @@ function! s:determine_build_system(dir) return '' endfunction +function! s:find_bundled(program) + let l:bundled = globpath(b:makeshift_root, a:program) + if filereadable(l:bundled) + return l:bundled + endif + return a:program +endfunction + function! s:set_makeprg(program) if len(a:program) - let &l:makeprg=a:program + if exists('g:makeshift_find_bundled') && g:makeshift_find_bundled + let &l:makeprg = s:find_bundled(a:program) + else + let &l:makeprg = a:program + endif endif endfunction