Skip to content

Task Examples

Linwei edited this page Feb 18, 2020 · 25 revisions

CMake Example

[project-init]
command=mkdir build && cd build && cmake .. -G "MinGW Makefiles"
cwd=<root>
errorformat=

[project-build]
command=cmake --build build
cwd=<root>
errorformat=%f:%m:%l

[project-run]
command="build/$(VIM_PRONAME)"
cwd=<root>
output=terminal

Grep Example

Project wide grep, will ask you input a keyword to search:

[grep-word]
command=rg -n --no-heading --color never "$(?keyword)" "<root>" -tcpp -tc -tpy -tvim -tgo -tasm
cwd=$(VIM_ROOT)
errorformat=%f:%l:%m

This task will search word under cursor directly without asking any input:

[grep-cword]
command=rg -n --no-heading --color never "$(VIM_CWORD)" "<root>" -tcpp -tc -tpy -tvim -tgo -tasm
cwd=$(VIM_ROOT)
errorformat=%f:%l:%m

They can be defined as a global task, and use a .ignore in each project to indicate what to search and what to skip.

Generate Ctags Database

[gen-tags]
command=ctags -R -f tags .
cwd=$(VIM_ROOT)
errorformat=

Don't forget set:

:set tags+=./tags;

It will allow vim search tags files in all parent directories of current buffer.

Clone this wiki locally