diff --git a/README.md b/README.md index a2ac0c4..705e505 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ and whenever one is found, it runs the cmake command there, assuming the CMakeLi file is just one directory above. Any arguments given to :CMake will be directly passed on to the cmake command. It also sets the working directory of the make command, so you can just use quickfix as with a normal Makefile project. +If you have the [AsyncRun plugin](https://github.com/skywind3000/asyncrun.vim) +installed, it will be used automatically and you will be able to check the +result of the cmake command in the quickfix as well. * `:CMakeClean` deletes all files in the build directory. You can think of this as a CMake version of make clean. diff --git a/plugin/cmake.vim b/plugin/cmake.vim index a4b16b5..2757096 100644 --- a/plugin/cmake.vim +++ b/plugin/cmake.vim @@ -68,8 +68,14 @@ function! s:cmake(...) let s:cmd = 'cmake '. l:argumentstr . " " . join(a:000) .' .. ' echo s:cmd - let s:res = system(s:cmd) - echo s:res + if exists(":AsyncRun") + execute 'copen' + execute 'AsyncRun ' . s:cmd + execute 'wincmd p' + else + let s:res = system(s:cmd) + echo s:res + endif exec 'cd - '