From c4eb6e1469bcb48d77e0426e9c747a6bcc7b2014 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 2 Nov 2018 21:12:02 +0100 Subject: [PATCH] SignifyDiff! will not open a new tab This makes is behave like :SignifyFold. Closes #271 --- autoload/sy/repo.vim | 6 ++++-- doc/signify.txt | 4 +++- plugin/signify.vim | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim index 7d9e940a..c15213d5 100644 --- a/autoload/sy/repo.vim +++ b/autoload/sy/repo.vim @@ -240,7 +240,7 @@ function! sy#repo#debug_detection() endfunction " Function: #diffmode {{{1 -function! sy#repo#diffmode() abort +function! sy#repo#diffmode(do_tab) abort execute sy#util#return_if_no_changes() let vcs = b:sy.updated_by @@ -252,7 +252,9 @@ function! sy#repo#diffmode() abort let cmd = s:expand_cmd(vcs, g:signify_vcs_cmds_diffmode) call sy#verbose('SignifyDiff: '. cmd, vcs) let ft = &filetype - tabedit % + if a:do_tab + tabedit % + endif diffthis let [cwd, chdir] = sy#util#chdir() try diff --git a/doc/signify.txt b/doc/signify.txt index 433d376f..3345bb2f 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -448,11 +448,13 @@ NOTE: Nothing will happen, if :SignifyRefresh is used from the |cmdline-window|. ------------------------------------------------------------------------------ *signify-:SignifyDiff* > - :SignifyDiff + :SignifyDiff[!] < Open a new tab with two windows using |diff-mode| to show the differences between the current file and its version that was last checked in. +With [!], no new tab will be opened. + Also see |g:signify_vcs_cmds_diffmode|. ------------------------------------------------------------------------------ diff --git a/plugin/signify.vim b/plugin/signify.vim index 73ced3ec..3a134424 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -66,7 +66,7 @@ augroup END command! -nargs=0 -bar SignifyList call sy#debug#list_active_buffers() command! -nargs=0 -bar SignifyDebug call sy#repo#debug_detection() command! -nargs=0 -bar -bang SignifyFold call sy#fold#dispatch(1) -command! -nargs=0 -bar SignifyDiff call sy#repo#diffmode() +command! -nargs=0 -bar -bang SignifyDiff call sy#repo#diffmode(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()