man.vim: Ensure 'modifiable' in man#init_pager #11450

This commit is contained in:
Anmol Sethi 2019-11-24 20:30:04 -05:00 committed by Justin M. Keyes
parent d5aaad14ec
commit 526798a941
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <anmol@aubble.com>
" Maintainer: Anmol Sethi <hi@nhooyr.io>
if exists('s:loaded_man')
finish
@ -357,6 +357,10 @@ function! s:format_candidate(path, psect) abort
endfunction
function! man#init_pager() abort
" https://github.com/neovim/neovim/issues/6828
let og_modifiable = &modifiable
setlocal modifiable
if getline(1) =~# '^\s*$'
silent keepjumps 1delete _
else
@ -374,6 +378,8 @@ function! man#init_pager() abort
if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95.
execute 'silent file man://'.tolower(fnameescape(ref))
endif
let &l:modifiable = og_modifiable
endfunction
function! man#goto_tag(pattern, flags, info) abort

View File

@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <anmol@aubble.com>
" Maintainer: Anmol Sethi <hi@nhooyr.io>
" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
if exists('b:current_syntax')
@ -30,6 +30,7 @@ endif
if !exists('b:man_sect')
call man#init_pager()
endif
if b:man_sect =~# '^[023]'
syntax case match
syntax include @c $VIMRUNTIME/syntax/c.vim