mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
man.vim: avoid creating extra blank buffers.
This commit is contained in:
parent
e073074414
commit
af0ca25ba9
@ -48,8 +48,9 @@ function man#get_page(...) abort
|
|||||||
exec 'let s:man_tag_col_'.s:man_tag_depth.' = '.col('.')
|
exec 'let s:man_tag_col_'.s:man_tag_depth.' = '.col('.')
|
||||||
let s:man_tag_depth = s:man_tag_depth + 1
|
let s:man_tag_depth = s:man_tag_depth + 1
|
||||||
|
|
||||||
" Use an existing "man" window if it exists, otherwise open a new one.
|
let editcmd = 'edit'
|
||||||
if !invoked_from_man
|
" Use an existing 'man' window, else open a new one.
|
||||||
|
if &filetype !=# 'man'
|
||||||
let thiswin = winnr()
|
let thiswin = winnr()
|
||||||
wincmd b
|
wincmd b
|
||||||
if winnr() > 1
|
if winnr() > 1
|
||||||
@ -64,13 +65,13 @@ function man#get_page(...) abort
|
|||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
if !invoked_from_man
|
|
||||||
tabnew
|
if &filetype !=# 'man'
|
||||||
let invoked_from_man = 1
|
let editcmd = 'tabnew'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
silent exec 'edit man://'.page.(empty(sect)?'':'('.sect.')')
|
silent exec editcmd.' man://'.page.(empty(sect)?'':'('.sect.')')
|
||||||
|
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
silent keepjumps norm! 1G"_dG
|
silent keepjumps norm! 1G"_dG
|
||||||
@ -86,7 +87,7 @@ function man#get_page(...) abort
|
|||||||
setlocal nomodified
|
setlocal nomodified
|
||||||
setlocal filetype=man
|
setlocal filetype=man
|
||||||
|
|
||||||
if invoked_from_man
|
if invoked_from_man || editcmd ==# 'tabnew'
|
||||||
call s:set_window_local_options()
|
call s:set_window_local_options()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user