diff options
-rw-r--r-- | runtime/autoload/man.vim | 23 | ||||
-rw-r--r-- | runtime/ftplugin/man.vim | 4 |
2 files changed, 17 insertions, 10 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index ec48d96dd6..8825719ec7 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -264,14 +264,6 @@ function! s:push_tag() abort \ }] endfunction -function! man#pop_tag() abort - if !empty(s:tag_stack) - let tag = remove(s:tag_stack, -1) - execute 'silent' tag['buf'].'buffer' - call cursor(tag['lnum'], tag['col']) - endif -endfunction - " extracts the name and sect out of 'path/name.sect' function! s:extract_sect_and_name_path(path) abort let tail = fnamemodify(a:path, ':t') @@ -410,4 +402,19 @@ function! man#init_pager() abort endif endfunction +function! man#goto_tag(pattern, flags, info) abort + " currently no support for section completion + let sect = "" + + let candidates = s:get_paths(sect, a:pattern) + + return map(candidates, { + \ _, path -> { + \ 'name': s:extract_sect_and_name_path(path)[1], + \ 'filename': 'man://' . path, + \ 'cmd': '1' + \ } + \ }) +endfunction + call s:init() diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 6c7f095f62..b3b23833ba 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -20,13 +20,13 @@ setlocal wrap breakindent linebreak setlocal nonumber norelativenumber setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable +setlocal tagfunc=man#goto_tag + if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') nnoremap <silent> <buffer> j gj nnoremap <silent> <buffer> k gk nnoremap <silent> <buffer> gO :call man#show_toc()<CR> - nnoremap <silent> <buffer> <C-]> :Man<CR> nnoremap <silent> <buffer> K :Man<CR> - nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR> if 1 == bufnr('%') || s:pager nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR> else |