From f6ba7d69be2c57f80c9ee95276733e949aceb009 Mon Sep 17 00:00:00 2001 From: Arsham Shirvani Date: Fri, 13 May 2022 15:49:08 +0100 Subject: fix(man.vim): q in "$MANPAGER mode" does not quit #18443 Problem: q in "$MANPAGER mode" does not quit Nvim. This is because ftplugin/man.vim creates its own mapping: nnoremap q :lclosec which overrides the one set by the autoload file when using :Man! ("$MANPAGER mode") Solution: Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the mapping correctly. Fixes #18281 Ref #17791 Helped-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> --- runtime/autoload/man.vim | 4 +--- runtime/ftplugin/man.vim | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 4d6a1f78dc..065ca8432e 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -125,9 +125,7 @@ endfunction function! s:set_options(pager) abort setlocal noswapfile buftype=nofile bufhidden=hide setlocal nomodified readonly nomodifiable - if a:pager - nnoremap q :lclose:q - endif + let b:pager = a:pager setlocal filetype=man endfunction diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index fce12012b5..d7a08a9941 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -24,7 +24,11 @@ if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') nnoremap k gk nnoremap gO :call man#show_toc() nnoremap <2-LeftMouse> :Man - nnoremap q :lclosec + if get(b:, 'pager') + nnoremap q :lcloseq + else + nnoremap q :lclosec + endif endif if get(g:, 'ft_man_folding_enable', 0) -- cgit