From 7a908c6f9cdbc60005428968faedab2b4e158bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Fri, 4 Dec 2020 11:18:37 +0100 Subject: [PATCH] Test running support using --- bundles-init/neomake.load.vim | 1 + bundles-init/vim-dispatch.load.vim | 1 + bundles-init/vim-test.cfg.vim | 8 ++++++ bundles-init/vim-test.load.vim | 1 + bundles-init/vimmake.cfg.vim | 44 ------------------------------ bundles-init/vimmake.load.vim | 1 - cfg/90-quickfix-toggle.vim | 42 ++++++++++++++++++++++++++++ 7 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 bundles-init/neomake.load.vim create mode 100644 bundles-init/vim-dispatch.load.vim create mode 100644 bundles-init/vim-test.cfg.vim create mode 100644 bundles-init/vim-test.load.vim delete mode 100644 bundles-init/vimmake.cfg.vim delete mode 100644 bundles-init/vimmake.load.vim create mode 100644 cfg/90-quickfix-toggle.vim diff --git a/bundles-init/neomake.load.vim b/bundles-init/neomake.load.vim new file mode 100644 index 0000000..4387390 --- /dev/null +++ b/bundles-init/neomake.load.vim @@ -0,0 +1 @@ +NeoBundle "neomake/neomake" diff --git a/bundles-init/vim-dispatch.load.vim b/bundles-init/vim-dispatch.load.vim new file mode 100644 index 0000000..a52d511 --- /dev/null +++ b/bundles-init/vim-dispatch.load.vim @@ -0,0 +1 @@ +NeoBundle 'tpope/vim-dispatch' diff --git a/bundles-init/vim-test.cfg.vim b/bundles-init/vim-test.cfg.vim new file mode 100644 index 0000000..ff95e50 --- /dev/null +++ b/bundles-init/vim-test.cfg.vim @@ -0,0 +1,8 @@ +" Run tests in the background, send results to the quickfix window +let test#strategy = 'dispatch' + +" Shortcuts +nmap :TestSuite +nmap :TestFile +nmap :TestNearest +nmap :TestLast diff --git a/bundles-init/vim-test.load.vim b/bundles-init/vim-test.load.vim new file mode 100644 index 0000000..e77dfa8 --- /dev/null +++ b/bundles-init/vim-test.load.vim @@ -0,0 +1 @@ +NeoBundle 'vim-test/vim-test' diff --git a/bundles-init/vimmake.cfg.vim b/bundles-init/vimmake.cfg.vim deleted file mode 100644 index 74c321c..0000000 --- a/bundles-init/vimmake.cfg.vim +++ /dev/null @@ -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 :silent call vimmake#toggle_quickfix(12) -" inoremap :silent call vimmake#toggle_quickfix(12)li -" noremap :silent call DoBuild(0) -" inoremap :silent call DoBuild(0)li -" noremap :silent call DoBuild(1) -" inoremap :silent call DoBuild(1)li -" noremap :silent call KillBuild() -" inoremap :silent call KillBuild()li -" noremap :silent call RunTest() -" inoremap :silent call RunTest()li -"endif diff --git a/bundles-init/vimmake.load.vim b/bundles-init/vimmake.load.vim deleted file mode 100644 index 010d829..0000000 --- a/bundles-init/vimmake.load.vim +++ /dev/null @@ -1 +0,0 @@ -"NeoBundle 'skywind3000/vimmake' diff --git a/cfg/90-quickfix-toggle.vim b/cfg/90-quickfix-toggle.vim new file mode 100644 index 0000000..3a4b15b --- /dev/null +++ b/cfg/90-quickfix-toggle.vim @@ -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 :call ToggleQuickfix(0)