diff --git a/vimrc b/vimrc index 126ee11..28fcbf4 100644 --- a/vimrc +++ b/vimrc @@ -240,13 +240,6 @@ map rn :sp ~/.work-files/dive-networks/files/notes/refactoring-notes.md< " AsyncRun status line let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) -" Toggle AsyncRun window -augroup vimrc - autocmd User AsyncRunStart call asyncrun#quickfix_toggle(8, 1) -augroup END -noremap :call asyncrun#quickfix_toggle(8) -nnoremap bb :call asyncrun#quickfix_toggle(8) - " Display error highlighting in source after running GCC with AsyncRun let g:asyncrun_auto = "make" @@ -259,16 +252,28 @@ set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m " Microsoft HLSL compiler: fxc.exe set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m -" Execute build script - -function! RunBuildCommand(command) - execute 'AsyncRun! -save=2' a:command +function! ToggleAsyncRunWindow() + call asyncrun#quickfix_toggle(8) endfunction -nnoremap b :call RunBuildCommand("./build.sh") -nnoremap :call RunBuildCommand("./build.sh") +function! ExecuteRunScript() + exec "AsyncRun! -post=call\\ ToggleAsyncRunWindow() ./run.sh" +endfunction + +" Show results window the moment the async job starts +augroup vimrc + autocmd User AsyncRunStart call asyncrun#quickfix_toggle(8, 1) +augroup END +" Toggle AsyncRun window +noremap :call ToggleAsyncRunWindow() +nnoremap bb :call ToggleAsyncRunWindow() + +" Execute build script +nnoremap b :AsyncRun! -save=2 ./build.sh +nnoremap :AsyncRun! -save=2 ./build.sh + " Execute run script -nnoremap br :AsyncRun! ./run.sh +nnoremap br :call ExecuteRunScript() "Go to next build error nnoremap :cn