From 5510d099ef3414f157a29d6fcca03520675e2e72 Mon Sep 17 00:00:00 2001 From: somini Date: Sun, 8 Nov 2015 23:13:21 +0000 Subject: [PATCH] Add option to choose default split type This adds a new variable that can be set to influence the default split method when using `:Man`. The other commands `Vman`, etc are unaffected. --- doc/man.txt | 10 ++++++++++ plugin/man.vim | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/man.txt b/doc/man.txt index da4c702..dd0f586 100644 --- a/doc/man.txt +++ b/doc/man.txt @@ -116,6 +116,16 @@ Default man command is '/usr/bin/man', but it can be changed: > let g:vim_man_cmd = 'LANG=ja_JP.UTF-8 /usr/bin/man' < + + +man_split_type *g:man_split_type* +Change the default split type when using |:Man|. Valid values are +'horizontal', 'vertical', or 'tab' + +> + let g:man_split_type = 'horizontal' +< + CONTRIBUTING *man-contributing* *man-bugs* Contributing and bug fixes are welcome. If you have an idea for a new feature diff --git a/plugin/man.vim b/plugin/man.vim index d03ce0f..0411a42 100644 --- a/plugin/man.vim +++ b/plugin/man.vim @@ -10,7 +10,11 @@ if !exists('g:vim_man_cmd') let g:vim_man_cmd='/usr/bin/man' endif -command! -nargs=* -bar -complete=customlist,man#completion#run Man call man#get_page('horizontal', ) +if !exists('g:man_split_type') + let g:man_split_type = 'horizontal' +endif + +command! -nargs=* -bar -complete=customlist,man#completion#run Man call man#get_page(g:man_split_type, ) command! -nargs=* -bar -complete=customlist,man#completion#run Sman call man#get_page('horizontal', ) command! -nargs=* -bar -complete=customlist,man#completion#run Vman call man#get_page('vertical', ) command! -nargs=* -bar -complete=customlist,man#completion#run Tman call man#get_page('tab', ) @@ -18,7 +22,7 @@ command! -nargs=* -bar -complete=customlist,man#completion#run Tman call man#get command! -nargs=+ -bang Mangrep call man#grep#run(0, ) " map a key to open a manpage for word under cursor, example: map ,k (Man) -nnoremap (Man) :call man#get_page_from_cword('horizontal', v:count) +nnoremap (Man) :call man#get_page_from_cword(g:man_split_type, v:count) nnoremap (Sman) :call man#get_page_from_cword('horizontal', v:count) nnoremap (Vman) :call man#get_page_from_cword('vertical', v:count)