From 7a4d069bccd3d19741d50d64052e386ac4e7cfc8 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sat, 19 Nov 2016 01:08:23 -0500 Subject: man.vim: do not assume ftplugin is sourced before syntax Fixes #5574 --- runtime/ftplugin/man.vim | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'runtime/ftplugin') diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 4ed21e146e..b8acd901a8 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,31 +1,15 @@ " Maintainer: Anmol Sethi " Previous Maintainer: SungHyun Nam -if exists('b:did_ftplugin') || &filetype !=# 'man' +if exists('b:did_ftplugin') finish endif let b:did_ftplugin = 1 -let s:pager = 0 +let s:pager = !exists('b:man_sect') -if has('vim_starting') - let s:pager = 1 - " remove all those backspaces - execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g') - if getline(1) =~# '^\s*$' - silent keepjumps 1delete _ - else - keepjumps 1 - endif - " This is not perfect. See `man glDrawArraysInstanced`. Since the title is - " all caps it is impossible to tell what the original capitilization was. - let ref = tolower(matchstr(getline(1), '^\S\+')) - try - let b:man_sect = man#extract_sect_and_name_ref(ref)[0] - catch - let b:man_sect = '' - endtry - execute 'silent file man://'.fnameescape(ref) +if s:pager + call man#init_pager() endif setlocal buftype=nofile -- cgit