From 592e0ec9efd3362078536c9a94f9db4e4cf12c77 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 22 Mar 2022 12:24:19 +0800 Subject: [PATCH] feat(git): add `git_diff_position` option close https://github.com/SpaceVim/SpaceVim/issues/3360 --- autoload/SpaceVim/layers/git.vim | 8 ++++++++ bundle/git.vim/autoload/git/diff.vim | 2 +- doc/SpaceVim.txt | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/git.vim b/autoload/SpaceVim/layers/git.vim index 1cdbdb52e..5bc5e3847 100644 --- a/autoload/SpaceVim/layers/git.vim +++ b/autoload/SpaceVim/layers/git.vim @@ -22,6 +22,13 @@ " name = 'git' " git_plugin = 'git' " < +" `git_diff_position`: set the default command to split diff windows, by +" default it is `10split`. Example: +" > +" [[layers]] +" name = 'git' +" git_diff_position = 'vsplit' +" < " @subsection Key bindings " " The following key bindings will be definded when the `git` layer is loaded. @@ -152,6 +159,7 @@ function! SpaceVim#layers#git#set_variable(var) abort \ get(a:var, \ 'git-plugin', \ s:git_plugin)) + let g:git_diff_position = get(a:var, 'git_diff_position', '10split') endfunction diff --git a/bundle/git.vim/autoload/git/diff.vim b/bundle/git.vim/autoload/git/diff.vim index d6528d4ff..1d92d9992 100644 --- a/bundle/git.vim/autoload/git/diff.vim +++ b/bundle/git.vim/autoload/git/diff.vim @@ -40,7 +40,7 @@ endfunction function! s:openDiffBuffer() abort - 10split git://diff + exe printf('%s git://diff', get(g:, 'git_diff_position', '10split')) normal! "_dd setl nobuflisted setl nomodifiable diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index af42fff5f..8b04de030 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -1938,6 +1938,13 @@ is `git`, the following plugins are supported: `gina`, `fugitive` and `gita`. name = 'git' git_plugin = 'git' < +`git_diff_position`: set the default command to split diff windows, by default +it is `10split`. Example: +> + [[layers]] + name = 'git' + git_diff_position = 'vsplit' +< KEY BINDINGS The following key bindings will be definded when the `git` layer is loaded.