revert: "man.vim: Ensure 'modifiable' in man#init_pager" #17791

This reverts commit 526798a941.

This will make man filetype not modifiable by default, as it is the
superior behavior in my opinion. More importantly, also make it possible
for a user to modify man filetypes by adding `set modifiable` in
`~/.config/nvim/ftplugin/man.vim` or its equivalent.

ref #11450
closes #17595

Co-authored-by: Javier López <graulopezjavier@gmail.com>
This commit is contained in:
dundargoc 2022-04-25 10:57:14 +02:00 committed by GitHub
parent 89df042a89
commit 440b65c338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,12 +123,12 @@ function! s:system(cmd, ...) abort
endfunction
function! s:set_options(pager) abort
setlocal filetype=man
setlocal noswapfile buftype=nofile bufhidden=hide
setlocal nomodified readonly nomodifiable
if a:pager
nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR>
endif
setlocal filetype=man
endfunction
function! s:get_page(path) abort
@ -473,10 +473,6 @@ endfunction
" Called when Nvim is invoked as $MANPAGER.
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
@ -496,7 +492,6 @@ function! man#init_pager() abort
endif
call s:set_options(v:true)
let &l:modifiable = og_modifiable
endfunction
function! man#goto_tag(pattern, flags, info) abort