Test running support using <F10><F11><F12>

This commit is contained in:
Emmanuel BENOîT 2020-12-04 11:18:37 +01:00
parent d0aae775d0
commit 7a908c6f9c
7 changed files with 53 additions and 45 deletions

View file

@ -0,0 +1 @@
NeoBundle "neomake/neomake"

View file

@ -0,0 +1 @@
NeoBundle 'tpope/vim-dispatch'

View file

@ -0,0 +1,8 @@
" Run tests in the background, send results to the quickfix window
let test#strategy = 'dispatch'
" Shortcuts
nmap <silent> <F10> :TestSuite<CR>
nmap <silent> <F11> :TestFile<CR>
nmap <silent> <S-F11> :TestNearest<CR>
nmap <silent> <C-F11> :TestLast<CR>

View file

@ -0,0 +1 @@
NeoBundle 'vim-test/vim-test'

View file

@ -1,44 +0,0 @@
"if exists( 'g:vim_local_path' )
" let g:vimmake_path = g:vim_local_path . 'scripts'
"
" let g:vimmake_mode = {}
" let g:vimmake_mode['clean'] = 'async'
" let g:vimmake_mode['build'] = 'async'
" let g:vimmake_mode['rebuild'] = 'async'
" let g:vimmake_mode['test'] = 'async'
"
" function! DoBuild(full)
" silent call vimmake#toggle_quickfix(12,1)
" if a:full == 0
" VimTool build
" else
" VimTool rebuild
" endif
" endfunc
"
" function! KillBuild()
" silent call vimmake#toggle_quickfix(0)
" VimStop
" endfunc
"
" function! RunTest()
" silent call vimmake#toggle_quickfix(12,1)
" VimTool test
" endfunc
"
" augroup QuickfixStatus
" au! BufWinEnter quickfix setlocal
" \ statusline=%t\ [%{g:vimmake_build_status}]\ %{exists('w:quickfix_title')?\ '\ '.w:quickfix_title\ :\ ''}\ %=%-15(%l,%c%V%)\ %P
" augroup END
"
" noremap <F12> :silent call vimmake#toggle_quickfix(12)<cr>
" inoremap <F12> <esc>:silent call vimmake#toggle_quickfix(12)<cr>li
" noremap <F10> :silent call DoBuild(0)<cr>
" inoremap <F10> <esc>:silent call DoBuild(0)<cr>li
" noremap <S-F10> :silent call DoBuild(1)<cr>
" inoremap <S-F10> <esc>:silent call DoBuild(1)<cr>li
" noremap <C-F10> :silent call KillBuild()<cr>
" inoremap <C-F10> <esc>:silent call KillBuild()<cr>li
" noremap <F11> :silent call RunTest()<cr>
" inoremap <F11> <esc>:silent call RunTest()<cr>li
"endif

View file

@ -1 +0,0 @@
"NeoBundle 'skywind3000/vimmake'

View file

@ -0,0 +1,42 @@
function! ToggleQuickfix(size, ...)
let l:mode = (a:0 == 0)? 2 : (a:1)
function! s:WindowCheck(mode)
if &buftype == 'quickfix'
let s:quickfix_open = 1
return
endif
if a:mode == 0
let w:quickfix_save = winsaveview()
else
if exists('w:quickfix_save')
call winrestview(w:quickfix_save)
unlet w:quickfix_save
endif
endif
endfunc
let s:quickfix_open = 0
let l:winnr = winnr()
noautocmd windo call s:WindowCheck(0)
noautocmd silent! exec ''.l:winnr.'wincmd w'
if l:mode == 0
if s:quickfix_open != 0
silent! cclose
endif
elseif l:mode == 1
if s:quickfix_open == 0
exec 'botright copen '. ((a:size > 0)? a:size : ' ')
wincmd k
endif
elseif l:mode == 2
if s:quickfix_open == 0
exec 'botright copen '. ((a:size > 0)? a:size : ' ')
wincmd k
else
silent! cclose
endif
endif
noautocmd windo call s:WindowCheck(1)
noautocmd silent! exec ''.l:winnr.'wincmd w'
endfunc
nmap <silent> <F12> :call ToggleQuickfix(0)<CR>