Skip to content

Conversation

@dundargoc
Copy link
Member

@dundargoc dundargoc commented Mar 20, 2022

This reverts commit 526798a.

This makes manpage not modifiable, which was the original (and IMO
superior) behavior. I also find the motivation for the commit to be
kinda lackluster to begin with:
https://github.com/powerman/vim-plugin-viewdoc doesn't seem to work if
the manpage isn't modifiable. I don't think this is good enough of a
justification if I'm being honest. I obviously don't wish to block
plugins but I just don't think this is the correct solution. An ideal
solution in my mind would be something that would enable the viewdoc
plugin while still keeping the nomodifiable behavior.

Ironically, using viewdoc to read a man manpage makes the text not
modifiable lol.

@dundargoc dundargoc force-pushed the revert/man/modifiable branch from 0ed833a to e850bf5 Compare March 20, 2022 21:18
@dundargoc
Copy link
Member Author

Oh yeah, also, this would prevent the goofy S^HSY^HYN^HNO^HOP^HPS^HSI^HIS^HS text appearing if you accidentally undo the text (not sure if it happens to anyone else, but I hate it when it happens).

@dundargoc dundargoc force-pushed the revert/man/modifiable branch 2 times, most recently from 3e61907 to 574dab9 Compare March 20, 2022 22:05
@dundargoc dundargoc requested a review from seandewar March 20, 2022 22:06
@muniter
Copy link
Member

muniter commented Mar 20, 2022

I think #17595 won't be fixed completely by this. The issue there is an option the user is setting in his ftplugin is being overwritten. I think moving where we set the filetype would fix the issue for all other cases as well.

diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index b28170b7a..0afea66a5 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -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

@dundargoc

This comment was marked as off-topic.

@dundargoc dundargoc force-pushed the revert/man/modifiable branch from 574dab9 to 7f0d9a7 Compare March 21, 2022 09:11
@dundargoc dundargoc force-pushed the revert/man/modifiable branch 3 times, most recently from 2d045f1 to 20d22c9 Compare April 1, 2022 10:09
@dundargoc dundargoc closed this Apr 4, 2022
@github-actions github-actions bot removed the request for review from seandewar April 4, 2022 13:50
@dundargoc dundargoc deleted the revert/man/modifiable branch April 4, 2022 13:50
@dundargoc dundargoc restored the revert/man/modifiable branch April 20, 2022 13:47
@dundargoc dundargoc reopened this Apr 20, 2022
@dundargoc dundargoc added the runtime funtime label Apr 20, 2022
@dundargoc dundargoc requested a review from gpanders April 20, 2022 13:48
@dundargoc dundargoc force-pushed the revert/man/modifiable branch from 20d22c9 to 0d18a38 Compare April 20, 2022 15:09
@justinmk
Copy link
Member

No objections and agreed on the assessment. Are you going to include @muniter 's suggestion?

@dundargoc
Copy link
Member Author

dundargoc commented Apr 24, 2022

Doh, I misunderstood @muniter's suggestion, it does in fact solve the problem of making manfiles modifiable if one wants to. Done.

Copy link
Member

@justinmk justinmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please include the explanation in the commit message :) (seems like the commits should be squashed)

This reverts commit 526798a.

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.
@dundargoc dundargoc force-pushed the revert/man/modifiable branch from e960843 to e41d9f4 Compare April 25, 2022 06:38
@dundargoc

This comment was marked as resolved.

@justinmk justinmk merged commit 440b65c into neovim:master Apr 25, 2022
@github-actions github-actions bot removed the request for review from gpanders April 25, 2022 08:57
@dundargoc dundargoc deleted the revert/man/modifiable branch April 25, 2022 12:42
arsham added a commit to arsham/neovim that referenced this pull request May 5, 2022
This commit fixes the issue when neovim is opened as a pager, and q
mapping causes an error.

Fixes neovim#18281
Ref neovim#17791
arsham added a commit to arsham/neovim that referenced this pull request May 12, 2022
This commit fixes the issue when neovim is opened as a pager, and q
mapping causes an error.

Fixes neovim#18281
Ref neovim#17791
arsham added a commit to arsham/neovim that referenced this pull request May 13, 2022
This commit fixes the issue when neovim is opened as a pager, and q
mapping causes an error.

The creation of the mapping in the autoload/man.vim has been moved to
the ftplugin/man.vim, and instead we set a flag in the buffer just
before the filetype is set, and conditionally in the ftplugin/man.vim we
set a proper mapping based on whether the buffer is a pager or not. This
way these two mapping sets would not override each other.

Fixes neovim#18281
Ref neovim#17791
justinmk pushed a commit to arsham/neovim that referenced this pull request May 13, 2022
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes neovim#18281
Ref neovim#17791

Helped-by: Gregory Anders <[email protected]>
justinmk pushed a commit to arsham/neovim that referenced this pull request May 13, 2022
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes neovim#18281
Ref neovim#17791

Helped-by: Gregory Anders <[email protected]>
justinmk pushed a commit to arsham/neovim that referenced this pull request May 13, 2022
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes neovim#18281
Ref neovim#17791

Helped-by: Gregory Anders <[email protected]>
justinmk pushed a commit to arsham/neovim that referenced this pull request May 13, 2022
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes neovim#18281
Ref neovim#17791

Helped-by: Gregory Anders <[email protected]>
justinmk pushed a commit that referenced this pull request May 13, 2022
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes #18281
Ref #17791

Helped-by: Gregory Anders <[email protected]>
kraftwerk28 pushed a commit to kraftwerk28/neovim that referenced this pull request Jun 1, 2022
This reverts commit 526798a.

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 neovim#11450
closes neovim#17595

Co-authored-by: Javier López <[email protected]>
kraftwerk28 pushed a commit to kraftwerk28/neovim that referenced this pull request Jun 1, 2022
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes neovim#18281
Ref neovim#17791

Helped-by: Gregory Anders <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

runtime funtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants