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

Using neovim as $MANPAGER fails when stderr is redirected #13845

Open
ybc37 opened this issue Jan 29, 2021 · 0 comments
Open

Using neovim as $MANPAGER fails when stderr is redirected #13845

ybc37 opened this issue Jan 29, 2021 · 0 comments
Labels
bug issues reporting wrong behavior plugin plugins and Vim "pack" runtime funtime

Comments

@ybc37
Copy link

ybc37 commented Jan 29, 2021

Hey there!

I'm using neovim as manpager (as described in :h man -> MANPAGER='nvim +Man!') and while it works great, I ran into an issue using fish-shells' Alt+h/F1 functionality. This shortcut jumps directly into the man page of the command under the cursor. Using it, neovim flashes up and it seems it tries to execute a lot of commands (they're all failing with E21: Cannot make changes, 'modifiable' is off, which is expected with +Man!).

After looking at the fish function I pinned it down to using man with a redirection: man ls 2>/dev/null, or more generally: echo "foo" | nvim -u NORC 2>/dev/null.

stderr of man ls 2>./log:

Vim: Error reading input, exiting...

Vim: Finished.
man: command exited with status 1: sed -e '/^[[:space:]]*$/{ N; /^[[:space:]]*\n[[:space:]]*$/D; }' | LESS=-ix8RmPm Manual page ls(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page ls(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=ls(1) nvim +Man!

stderr of echo "foo" | nvim -u NORC 2>./log:

Vim: Error reading input, exiting...

Vim: preserving files...
Vim: Finished.

With vim as manpager (MANPAGER="vim -M +MANPAGER -") it behaves more or less the same, but outputs some errors/warnings to stdout, too.

  • nvim --version: NVIM v0.5.0-dev+1055-g8950f4e94
  • vim -u DEFAULTS (version: 8.2) behaves differently? very similar
  • Operating system/version: Arch Linux
  • Terminal name/version: alacritty
  • $TERM: tmux-256color

Steps to reproduce

# set nvim as manpager
# bash: `export MANPAGER='nvim +Man!'`
# fish: `set -x MANPAGER "nvim +Man!"`
man ls 2>/dev/null
# or
echo "foo" | nvim -u NORC 2>/dev/null

Actual behaviour

  • nvim starts
  • nvim tries to execute commands, failing with E21: Cannot make changes, 'modifiable' is off
  • nvim closes

Expected behaviour

  • nvim opens man page/piped text
  • errors are redirected
@ybc37 ybc37 added the bug issues reporting wrong behavior label Jan 29, 2021
@teto teto added the pager label Jan 29, 2021
@zeertzjq zeertzjq added plugin plugins and Vim "pack" runtime funtime and removed pager labels Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior plugin plugins and Vim "pack" runtime funtime
Projects
None yet
Development

No branches or pull requests

3 participants