mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 03:45:42 +00:00
man.vim: Simplify man#init to reduce load time (#12482)
I removed the SunOS stuff since no one uses SunOS and I've never tested it on there. I removed the section_flag init as we can just use -S instead of -s and -S is used by every implementation as far as I know. This brings man#init's time from 50-70ms to 15-20ms for me. Closes #12318 Related #6766 Related #6815
This commit is contained in:
@@ -7,22 +7,10 @@ let s:loaded_man = 1
|
|||||||
|
|
||||||
let s:find_arg = '-w'
|
let s:find_arg = '-w'
|
||||||
let s:localfile_arg = v:true " Always use -l if possible. #6683
|
let s:localfile_arg = v:true " Always use -l if possible. #6683
|
||||||
let s:section_arg = '-s'
|
|
||||||
|
|
||||||
function! s:init_section_flag()
|
|
||||||
call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man'])
|
|
||||||
if v:shell_error
|
|
||||||
let s:section_arg = '-S'
|
let s:section_arg = '-S'
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:init() abort
|
function! man#init() abort
|
||||||
call s:init_section_flag()
|
|
||||||
" TODO(nhooyr): Does `man -l` on SunOS list searched directories?
|
|
||||||
try
|
try
|
||||||
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
|
|
||||||
let s:find_arg = '-l'
|
|
||||||
endif
|
|
||||||
" Check for -l support.
|
" Check for -l support.
|
||||||
call s:get_page(s:get_path('', 'man'))
|
call s:get_page(s:get_path('', 'man'))
|
||||||
catch /E145:/
|
catch /E145:/
|
||||||
@@ -466,4 +454,4 @@ function! man#goto_tag(pattern, flags, info) abort
|
|||||||
\ })
|
\ })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:init()
|
call man#init()
|
||||||
|
|||||||
Reference in New Issue
Block a user