feat(man.vim): "q" always closes window #30819

This commit is contained in:
xudyang1 2024-10-15 11:34:50 -04:00 committed by GitHub
parent 84623dbe93
commit ea5b748f24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 6 deletions

View File

@ -269,6 +269,10 @@ These existing features changed their behavior.
• |vim.on_key()| callbacks won't be invoked recursively when a callback itself • |vim.on_key()| callbacks won't be invoked recursively when a callback itself
consumes input. consumes input.
• "q" in man pages now uses |CTRL-W_q| instead of |CTRL-W_c| to close the
current window, and it no longer throws |E444| when there is only one window
on the screen. Global variable `vim.g.pager` is removed.
============================================================================== ==============================================================================
REMOVED FEATURES *news-removed* REMOVED FEATURES *news-removed*

View File

@ -26,11 +26,7 @@ if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nnoremap <silent> <buffer> k gk nnoremap <silent> <buffer> k gk
nnoremap <silent> <buffer> gO :lua require'man'.show_toc()<CR> nnoremap <silent> <buffer> gO :lua require'man'.show_toc()<CR>
nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR> nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
if get(g:, 'pager')
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
else
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
endif
endif endif
if get(g:, 'ft_man_folding_enable', 0) if get(g:, 'ft_man_folding_enable', 0)

View File

@ -675,7 +675,6 @@ function M.init_pager()
vim.cmd.file({ 'man://' .. fn.fnameescape(ref):lower(), mods = { silent = true } }) vim.cmd.file({ 'man://' .. fn.fnameescape(ref):lower(), mods = { silent = true } })
end end
vim.g.pager = true
set_options() set_options()
end end