Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftplugin: sh: don't assume MANPAGER makes sense #14679

Closed
wants to merge 1 commit into from

Conversation

benknoble
Copy link
Contributor

Say you use Vim and set MANPAGER='vim -M +MANPAGER --not-a-term -'; then :ShKeywordPrg (or K) will crap out and spew terminal garbage into less when bash's "help" fails. This was introduced by 2f25e40 (runtime: configure keywordpg for some file types (#5566), 2023-08-23) and may be present in other files touched by that commit.

Make the "man" invocation sensible by unsetting MANPAGER in the environment.

@benknoble benknoble requested a review from dkearns as a code owner May 1, 2024 01:32
benknoble added a commit to benknoble/Dotfiles that referenced this pull request May 1, 2024
vim/vim@2f25e40b1 (runtime: configure keywordpg for some file types
(#5566), 2023-08-23) added a new keywordprg for Shell files (it was
renamed from :Help to ShKeywordPrg in vim/vim@2a281ccca (runtime(sh):
Update ftplugin (#13213), 2023-10-07)).

Something about it craps out for me, though, dumping terminal garbage
all over the screen, and I prefer :Man anyway.

See also vim/vim#14679
@chrisbra
Copy link
Member

chrisbra commented May 1, 2024

Thanks. Does it make sense to use instead:

unlet $MANPAGER

@benknoble
Copy link
Contributor Author

Thanks. Does it make sense to use instead:

unlet $MANPAGER

I doubt it: that would mess with the user's environment for that Vim, right? In other words, there's not a good way to scope that to just this command (without the save/unlet/restore block), right?

@chrisbra
Copy link
Member

chrisbra commented May 1, 2024

okay, fine then. @dkearns are you fine with it?

@Konfekt
Copy link
Contributor

Konfekt commented May 5, 2024

Thank you @benknoble, grepping shows that a similar &keywordprg command is used for some other files, however manpager is unset for all them except zsh.vim, which does not use it.

Ideally, one day one would employ your solution.

Say you use Vim and set MANPAGER='vim -M +MANPAGER --not-a-term -'; then
:{Zs,S}hKeywordPrg (or K) will crap out and spew terminal garbage into
less when bash's "help" fails. This was introduced by 2f25e40
(runtime: configure keywordpg for some file types (vim#5566), 2023-08-23)
and may be present in other files touched by that commit.

Make the "man" invocation sensible by unsetting MANPAGER in the
environment.

Note that changing MANPAGER for `:terminal` is not needed; Vim within
Vim is perfectly fine.
@benknoble
Copy link
Contributor Author

I've fixed this up to change Zsh, too. It's true that my code for Git config and SSH config is a bit more sophisticated, but it does assume you want to use :Man.

@chrisbra
Copy link
Member

chrisbra commented May 6, 2024

Thanks, I include it

chrisbra added a commit to chrisbra/vim-zsh that referenced this pull request May 6, 2024
@chrisbra chrisbra closed this in 8d8cb45 May 6, 2024
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request May 7, 2024
runtime(sh,zsh): clear $MANPAGER in ftplugin before shelling out

Say you use Vim and set MANPAGER='vim -M +MANPAGER --not-a-term -'; then
:{Zs,S}hKeywordPrg (or K) will crap out and spew terminal garbage into
less when bash's "help" fails. This was introduced by 2f25e40b1
(runtime: configure keywordpg for some file types (vim/vim#5566), 2023-08-23)
and may be present in other files touched by that commit.

Make the "man" invocation sensible by unsetting MANPAGER in the
environment.

Note that changing MANPAGER for `:terminal` is not needed; Vim within
Vim is perfectly fine.

closes: vim/vim#14679

vim/vim@8d8cb45

Co-authored-by: D. Ben Knoble <[email protected]>
zeertzjq added a commit to neovim/neovim that referenced this pull request May 7, 2024
runtime(sh,zsh): clear $MANPAGER in ftplugin before shelling out

Say you use Vim and set MANPAGER='vim -M +MANPAGER --not-a-term -'; then
:{Zs,S}hKeywordPrg (or K) will crap out and spew terminal garbage into
less when bash's "help" fails. This was introduced by 2f25e40b1
(runtime: configure keywordpg for some file types (vim/vim#5566), 2023-08-23)
and may be present in other files touched by that commit.

Make the "man" invocation sensible by unsetting MANPAGER in the
environment.

Note that changing MANPAGER for `:terminal` is not needed; Vim within
Vim is perfectly fine.

closes: vim/vim#14679

vim/vim@8d8cb45

Co-authored-by: D. Ben Knoble <[email protected]>
@benknoble benknoble deleted the fix-ShKeywordPrg-manpager branch May 11, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants