From 9bba8ba372298d7cfac543085df6546e18d2c256 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sat, 3 Sep 2016 21:53:58 -0400 Subject: [RFC] man.vim: remove mappings (#5290) - :Man with no arguments opens the manapage for the (man buffers) or (non-man buffers). - remove now irrelevent comment about -P flag --- runtime/autoload/man.vim | 9 +++++---- runtime/doc/filetype.txt | 9 ++------- runtime/ftplugin/man.vim | 4 ++-- runtime/plugin/man.vim | 10 +--------- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 20afbb8b43..bd8062f2b3 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -9,8 +9,7 @@ endif let s:man_find_arg = "-w" " TODO(nhooyr) Completion may work on SunOS; I'm not sure if `man -l` displays -" the list of searched directories. I also do not think Solaris supports the -" '-P' flag used above and uses only $PAGER. +" the list of searched directories. try if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5' let s:man_find_arg = '-l' @@ -23,11 +22,13 @@ function! man#open_page(count, count1, mods, ...) abort if a:0 > 2 call s:error('too many arguments') return - elseif a:0 ==# 1 - if empty(a:1) + elseif a:0 == 0 + let ref = &filetype ==# 'man' ? expand('') : expand('') + if empty(ref) call s:error('no identifier under cursor') return endif + elseif a:0 ==# 1 let ref = a:1 else " Combine the name and sect into a manpage reference so that all diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 21092b7081..df6b55cfe7 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -529,17 +529,12 @@ Man {sect} {name}({sect}) Used during completion to show the real section of when the provided section is a prefix, e.g. 1m vs 1. Man {path} Open the manpage specified by path. Prepend "./" if page is in the current directory. +Man Open the manpage for the (man buffers) + or (non-man buffers) under the cursor. |:Man| accepts command modifiers. For example, to use a vertical split: > :vertical Man printf -Global Mappings: -(man) Jump to the manpage for the (man buffers) - or (non-man buffers) under the cursor. - Takes a count for the section. -(man_vsplit) Same as (man) but open in a vertical split. -(man_tab) Same as (man) but open in a new tab. - Local mappings: K or CTRL-] Jump to the manpage for the under the cursor. Takes a count for the section. diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 08a88e6b90..02d2b4e557 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -43,8 +43,8 @@ setlocal nolist setlocal nofoldenable if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') - nmap (man) - nmap K (man) + nmap :Man + nmap K :Man nnoremap :call man#pop_tag() if s:pager nnoremap q :q diff --git a/runtime/plugin/man.vim b/runtime/plugin/man.vim index df457c2243..63faa15213 100644 --- a/runtime/plugin/man.vim +++ b/runtime/plugin/man.vim @@ -5,15 +5,7 @@ if exists('g:loaded_man') endif let g:loaded_man = 1 -command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, , ) - -function! s:cword() abort - return &filetype ==# 'man' ? expand('') : expand('') -endfunction - -nnoremap (man) :execute 'Man ' .cword() -nnoremap (man_vsplit) :execute 'vertical Man '.cword() -nnoremap (man_tab) :execute 'tab Man ' .cword() +command! -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, , ) augroup man autocmd! -- cgit