Skip to content

Commit 8d19c11

Browse files
committed
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.
1 parent a754d1f commit 8d19c11

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

doc/man.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ Default man command is '/usr/bin/man', but it can be changed:
116116
>
117117
let g:vim_man_cmd = 'LANG=ja_JP.UTF-8 /usr/bin/man'
118118
<
119+
120+
121+
man_split_type *g:man_split_type*
122+
Change the default split type when using |:Man|. Valid values are
123+
'horizontal', 'vertical', or 'tab'
124+
125+
>
126+
let g:man_split_type = 'horizontal'
127+
<
128+
119129
CONTRIBUTING *man-contributing* *man-bugs*
120130

121131
Contributing and bug fixes are welcome. If you have an idea for a new feature

plugin/man.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ if !exists('g:vim_man_cmd')
1010
let g:vim_man_cmd='/usr/bin/man'
1111
endif
1212

13-
command! -nargs=* -bar -complete=customlist,man#completion#run Man call man#get_page('horizontal', <f-args>)
13+
if !exists('g:man_split_type')
14+
let g:man_split_type = 'horizontal'
15+
endif
16+
17+
command! -nargs=* -bar -complete=customlist,man#completion#run Man call man#get_page(g:man_split_type, <f-args>)
1418
command! -nargs=* -bar -complete=customlist,man#completion#run Sman call man#get_page('horizontal', <f-args>)
1519
command! -nargs=* -bar -complete=customlist,man#completion#run Vman call man#get_page('vertical', <f-args>)
1620
command! -nargs=* -bar -complete=customlist,man#completion#run Tman call man#get_page('tab', <f-args>)
1721

1822
command! -nargs=+ -bang Mangrep call man#grep#run(<bang>0, <f-args>)
1923

2024
" map a key to open a manpage for word under cursor, example: map ,k <Plug>(Man)
21-
nnoremap <silent> <Plug>(Man) :<C-U>call man#get_page_from_cword('horizontal', v:count)<CR>
25+
nnoremap <silent> <Plug>(Man) :<C-U>call man#get_page_from_cword(g:man_split_type, v:count)<CR>
2226
nnoremap <silent> <Plug>(Sman) :<C-U>call man#get_page_from_cword('horizontal', v:count)<CR>
2327
nnoremap <silent> <Plug>(Vman) :<C-U>call man#get_page_from_cword('vertical', v:count)<CR>
2428

0 commit comments

Comments
 (0)