vim/plugin/commands.vim
Kenneth Benzie (Benie) a0df92852a 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.
2021-01-05 21:45:43 +00:00

36 lines
1.2 KiB
VimL

" minpac
function! s:minpac_init() abort
packadd minpac | call minpac#init() | source $MYVIMRC
endfunction
command! PackUpdate call s:minpac_init() | call minpac#update('', {'do': 'call minpac#status()'})
command! PackStatus call s:minpac_init() | call minpac#status()
command! PackClean call s:minpac_init() | call minpac#clean()
" Sort Python Imports
command! ISort call do#isort()
" Strip white space from right of all lines.
" TODO: Make RStripLines work on a range
command! RStripLines call do#rstrip_lines()
" TODO: Strip white space from left of all lines, retains relative indentation.
" Set tab width
command! -nargs=1 TabWidth call do#set_tab_width(<f-args>)
" Toggle Checkbox
command! ToggleCheckbox call do#toggle_checkbox()
" Show highlight groups under the cursor
command! CursorHighlightGroups call do#cursor_highlight_groups()
" Setup and invoke a :TermdebugCommand
command! -nargs=+ -complete=file Debug call do#debug(<f-args>)
" Find all TODO items in the current file and populate the location list
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>)