From 64399b24047677b1616610ae8295bfd849449dc8 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 18 Nov 2014 11:23:34 -0500 Subject: [PATCH] Sync syntastic toggle actions + disable with extradite to avoid conflict --- vim/config/keyboard.vim | 18 +++++++++--------- vim/config/plugins.vim | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 3112262..10d5a29 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -513,12 +513,12 @@ inoremap ':TagbarToggle' "view commit history and diffs - nnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' - xnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' - inoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' - nnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' - xnoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' - inoremap ':Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' + nnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' + xnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' + inoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' + nnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' + xnoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' + inoremap ':SyntasticToggleOff:Extradite!:resize 10:wincmd x:wincmd b:wincmd H:wincmd b' "toggle line wrapping (and bottom bar if using the gui) nnoremap ':set wrap!:echo "line wrapping toggled"' @@ -534,9 +534,9 @@ set pastetoggle= "toggle syntax checking - nnoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0elselet g:syntastic_check_on_open=1endif:SyntasticToggleMode' - xnoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0elselet g:syntastic_check_on_open=1endif:SyntasticToggleModegv' - inoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0elselet g:syntastic_check_on_open=1endif:SyntasticToggleMode' + nnoremap ':SyntasticToggleAll' + xnoremap ':SyntasticToggleAllgv' + inoremap ':SyntasticToggleAll' "toggle goyo nnoremap ':Goyo' diff --git a/vim/config/plugins.vim b/vim/config/plugins.vim index 0caa111..8910016 100644 --- a/vim/config/plugins.vim +++ b/vim/config/plugins.vim @@ -178,6 +178,34 @@ let g:syntastic_auto_loc_list=1 let g:syntastic_loc_list_height=5 endif + + "function to enable syntastic and set check_on_open on + function s:SyntasticToggleOn() + let g:syntastic_check_on_open=1 + if (g:syntastic_mode_map.mode == "passive") + SyntasticToggleMode + endif + endfunction + command! -buffer SyntasticToggleOn call s:SyntasticToggleOn() + + "function to disable syntastic and set check_on_open off + function s:SyntasticToggleOff() + let g:syntastic_check_on_open=0 + if (g:syntastic_mode_map.mode == "active") + SyntasticToggleMode + endif + endfunction + command! -buffer SyntasticToggleOff call s:SyntasticToggleOff() + + "function to toggle syntastic and check_on_open on and off together + function s:SyntasticToggleAll() + if (g:syntastic_check_on_open == 1) + call s:SyntasticToggleOff() + else + call s:SyntasticToggleOn() + endif + endfunction + command! -buffer SyntasticToggleAll call s:SyntasticToggleAll() "}}} "TABULAR: {{{