mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
man.vim: set window local options when reusing buffer
This is necessary incase the buffer was previously opened in a different tab, in which the window options there do not carry over. It is not explicitly documented in ':help local-options' but that is how it works.
This commit is contained in:
parent
728d582333
commit
10b014ca7b
@ -59,6 +59,7 @@ function! man#open_page(count, count1, mods, ...) abort
|
||||
if a:mods !~# 'tab' && s:find_man()
|
||||
if s:manwidth() ==# getbufvar(bufname, 'manwidth')
|
||||
silent execute 'buf' bufname
|
||||
call man#set_window_local_options()
|
||||
keepjumps 1
|
||||
return
|
||||
endif
|
||||
@ -68,6 +69,7 @@ function! man#open_page(count, count1, mods, ...) abort
|
||||
endif
|
||||
noautocmd execute a:mods 'split' bufname
|
||||
if s:manwidth() ==# get(b:, 'manwidth')
|
||||
call man#set_window_local_options()
|
||||
keepjumps 1
|
||||
return
|
||||
endif
|
||||
@ -203,6 +205,15 @@ function! s:manwidth() abort
|
||||
return $MANWIDTH
|
||||
endfunction
|
||||
|
||||
function! man#set_window_local_options() abort
|
||||
setlocal nonumber
|
||||
setlocal norelativenumber
|
||||
setlocal foldcolumn=0
|
||||
setlocal colorcolumn=0
|
||||
setlocal nolist
|
||||
setlocal nofoldenable
|
||||
endfunction
|
||||
|
||||
function! s:man_args(sect, name) abort
|
||||
if empty(a:sect)
|
||||
return shellescape(a:name)
|
||||
|
@ -33,12 +33,7 @@ setlocal tabstop=8
|
||||
setlocal softtabstop=8
|
||||
setlocal shiftwidth=8
|
||||
|
||||
setlocal nonumber
|
||||
setlocal norelativenumber
|
||||
setlocal foldcolumn=0
|
||||
setlocal colorcolumn=0
|
||||
setlocal nolist
|
||||
setlocal nofoldenable
|
||||
call man#set_window_local_options()
|
||||
|
||||
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
|
||||
nmap <silent> <buffer> <C-]> <Plug>(Man)
|
||||
|
Loading…
Reference in New Issue
Block a user