From e134c152e05ec750091349629f048fe3d5d49962 Mon Sep 17 00:00:00 2001 From: William Clemens Date: Wed, 6 Jan 2016 17:00:21 -0600 Subject: [PATCH] Add :SignifyEnable and :SignifyDisable --- autoload/sy.vim | 28 +++++++++++++++++++++------- doc/signify.txt | 14 ++++++++++++++ plugin/signify.vim | 2 ++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/autoload/sy.vim b/autoload/sy.vim index fa11516..20fbdf6 100644 --- a/autoload/sy.vim +++ b/autoload/sy.vim @@ -110,19 +110,33 @@ function! sy#stop(bufnr) abort call sy#sign#remove_all_signs(a:bufnr) endfunction -" Function: #toggle {{{1 -function! sy#toggle() abort +" Function: #enable {{{1 +function! sy#enable() abort if !exists('b:sy') call sy#start() return endif - if b:sy.active - call sy#stop(b:sy.buffer) - let b:sy.active = 0 - let b:sy.stats = [-1, -1, -1] - else + if !b:sy.active let b:sy.active = 1 call sy#start() endif endfunction + +" Function: #disable {{{1 +function! sy#disable() abort + if exists('b:sy') && b:sy.active + call sy#stop(b:sy.buffer) + let b:sy.active = 0 + let b:sy.stats = [-1, -1, -1] + endif +endfunction + +" Function: #toggle {{{1 +function! sy#toggle() abort + if !exists('b:sy') || !b:sy.active + call sy#enable() + else + call sy#disable() + endif +endfunction diff --git a/doc/signify.txt b/doc/signify.txt index 9bf037f..f33832f 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -310,6 +310,20 @@ Default: [3, 8] ============================================================================== COMMAND *signify-commands* + *signify-:SignifyEnable* +> + :SignifyEnable +< +Enable the plugin for the current buffer only. + +------------------------------------------------------------------------------ + *signify-:SignifyDisable* +> + :SignifyDisable +< +Disable the plugin for the current buffer only. + +------------------------------------------------------------------------------ *signify-:SignifyToggle* > :SignifyToggle diff --git a/plugin/signify.vim b/plugin/signify.vim index 8a5440c..d601484 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -43,6 +43,8 @@ command! -nargs=0 -bar SignifyDebugDiff call sy#debug#verbose_diff_c command! -nargs=0 -bar SignifyDebugUnknown call sy#repo#debug_detection() command! -nargs=0 -bar -bang SignifyFold call sy#fold#dispatch(1) command! -nargs=0 -bar SignifyRefresh call sy#util#refresh_windows() +command! -nargs=0 -bar SignifyEnable call sy#enable() +command! -nargs=0 -bar SignifyDisable call sy#disable() command! -nargs=0 -bar SignifyToggle call sy#toggle() command! -nargs=0 -bar SignifyToggleHighlight call sy#highlight#line_toggle()