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.