zdharma-continuum / fast-syntax-highlighting

Feature-rich syntax highlighting for ZSH
BSD 3-Clause "New" or "Revised" License
1.06k stars 76 forks source link

[bug]: Man command highlighting as error #35

Open SystematicError opened 2 years ago

SystematicError commented 2 years ago

Describe the bug

The argument passed to man is always highlighted as red, indicating something is wrong when the command is perfectly valid

Steps to reproduce

Install and source the plugin

Expected behavior

The argument passed should be colored red only if the man page does not exist

Screenshots and recordings

image

Operating System & Version

linux-gnu | pc | x86_64 | x86_64 | x86_64 unknown

Zsh version

zsh 5.8.1 (x86_64-pc-linux-gnu)

Terminal emulator

xterm-kitty

If using WSL on Windows, which version of WSL

No response

Additional context

No response

warbacon commented 2 years ago

From what I tested, this only happens in Arch-based distributions.

TIBCOeddie commented 1 year ago

WORSE I type man and it delays for about 30 seconds! macOS arch64

SystematicError commented 1 year ago

From what I tested, this only happens in Arch-based distributions.

Sorry for the late reply, I indeed am on an arch based distro

LeuschkeTressa commented 1 year ago

Similar to/duplicate of https://github.com/zdharma-continuum/fast-syntax-highlighting/issues/27.

warbacon commented 1 year ago

I think I have finally found the reason why this bug occurs (at least in Arch Linux). This plugin seems to be using the whatis command to highlight the man argument. If this bug occurs on your system, whatis probably does not work properly either. You can check this by typing the command whatis ls for example.

The thing is that whatis depends in a index of all the available man pages in the system and Arch Linux does not generate it if you don't tell it to do so.

How to fix it?

If you are using man-db (most likely):

Arch Linux has a service called man-db.service as well as a timer called man-db.timer, which runs man-db.service daily. This service is responsible for generating the index of the man pages, so the bug should be fixed executing the following command:

sudo systemctl enable man-db.timer

You must run sudo mandb if you want to create an index instantly.

If you are using mandoc:

I don't know if there is a similar service as in man-db, but you can do sudo makewhatis /usr/share/man to generate the index.

I hope you find it helpful!

LeuschkeTressa commented 1 year ago

@Warbacon I came to a similar conclusion,see https://github.com/zdharma-continuum/fast-syntax-highlighting/issues/27 for details and another possible workaround.