Skip to content

Commit

Permalink
Added option to choose between vertical, horizontal, and centered mag…
Browse files Browse the repository at this point in the history
…it display.

New option can be set by user as follows (in .vimrc)
> let g:magit_show_magit_display='v'
  • Loading branch information
Florent Bouchez Tichadou committed Mar 27, 2024
1 parent ffd5468 commit 09935b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,15 @@ example to your vimrc.

User can define in its prefered vimrc some options.

#### g:magit_show_magit_display
Choose display setup for magit (default: 'v')
Possible values:
'v': vertical split
'h': horizontal split
'c': current buffer
> let g:magit_show_magit_display='v'

#### g:magit_enabled

To enable or disable vimagit plugin.
Expand Down
8 changes: 8 additions & 0 deletions doc/vimagit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,14 @@ example to your vimrc.

User can define in its prefered |vimrc| some options.

*vimagit-g:magit_show_magit_display*
Choose display setup for magit (default: 'v')
Possible values:
'v': vertical split
'h': horizontal split
'c': current buffer
let g:magit_show_magit_display='v'

*vimagit-g:magit_enabled*
To enable or disable vimagit plugin.
Default value is 1.
Expand Down
6 changes: 4 additions & 2 deletions plugin/magit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ execute 'source ' . g:vimagit_path . '/../common/magit_common.vim'
let g:magit_show_magit_mapping = get(g:, 'magit_show_magit_mapping', '<leader>M' )

" user options
" default display: vertical split.
let g:magit_show_magit_display = get(g:, 'magit_show_magit_display', 'v')
let g:magit_enabled = get(g:, 'magit_enabled', 1)
let g:magit_show_help = get(g:, 'magit_show_help', 0)
let g:magit_default_show_all_files = get(g:, 'magit_default_show_all_files', 1)
Expand All @@ -48,7 +50,7 @@ let g:magit_warning_max_lines = get(g:, 'magit_warning_max_lines',

let g:magit_git_cmd = get(g:, 'magit_git_cmd' , "git")

execute "nnoremap <silent> " . g:magit_show_magit_mapping . " :call magit#show_magit('v')<cr>"
execute "nnoremap <silent> " . g:magit_show_magit_mapping . " :call magit#show_magit('" . g:magit_show_magit_display . "')<cr>"

if (g:magit_refresh_gutter == 1 || g:magit_refresh_gitgutter == 1)
autocmd User VimagitUpdateFile
Expand Down Expand Up @@ -1409,7 +1411,7 @@ function! magit#get_current_mode()
endif
endfunction

command! Magit call magit#show_magit('v')
command! Magit call magit#show_magit(g:magit_show_magit_display)
command! MagitOnly call magit#show_magit('c')

" }}}

0 comments on commit 09935b3

Please sign in to comment.