Add :Build command to invoke ninja or make
The `:Build [<target> ...]` command utilises the `$BUILD_DIR` variable set
by `:BuildDir {directory}` to invoke `ninja` or `make` based on the
existence of `$BUILD_DIR/build.ninja` or `$BUILD_DIR/Makefile`
respectively. The following commands are invoked in a new `:terminal`
window.
* `ninja -C $BUILD_DIR [<target> ...]` when `$BUILD_DIR/build.ninja` exists
* `make -C $BUILD_DIR [<target> ...]` when `$BUILD_DIR/Makefile` exists
In the case of `ninja`, completion for the targets supplied to the
`:Build` command is made available by the `build#targets()` function.
The list of targets returned by `ninja -C $BUILD_DIR -t targets` is
processed to generate the list of targets. Support for `make` target
completion is less straight forwards so has been omitted for now.
This commit is contained in:
@@ -32,3 +32,4 @@ command! TodoFile lvimgrep /todo/ %
|
||||
|
||||
" Change build directory
|
||||
command! -nargs=1 -complete=dir BuildDir call build#dir(<f-args>)
|
||||
command! -nargs=* -complete=custom,build#targets Build call build#run(<f-args>)
|
||||
|
||||
Reference in New Issue
Block a user