Skip to content

Commit

Permalink
Add option to choose default split type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
somini committed Jan 4, 2016
1 parent 3d26cb1 commit 5510d09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions doc/man.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions plugin/man.vim
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ 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', <f-args>)
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, <f-args>)
command! -nargs=* -bar -complete=customlist,man#completion#run Sman call man#get_page('horizontal', <f-args>)
command! -nargs=* -bar -complete=customlist,man#completion#run Vman call man#get_page('vertical', <f-args>)
command! -nargs=* -bar -complete=customlist,man#completion#run Tman call man#get_page('tab', <f-args>)

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

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

0 comments on commit 5510d09

Please sign in to comment.