-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[RFC] Man Plugin: Improve C highlighting #8709
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
Conversation
I'm unsure about this. :-) It doesn't work on macOS for some reason. I hadn't the time to check why yet. (Highlighting the SYNOPSIS section does work.) That's no show-stopper, though. It works in my Ubuntu VM, but it can lead to highlighting the text between the code blocks as C. (E.g. in So, do we prefer a pretty colorful section or no highlighting at all? |
I'm pretty sure it's a syntax syncing issue, but I'm not sure if I'm using If you If performance isn't an issue, the solution would be to add As for the wrong highlighted English in the Example section, I like the highlighted code more than I dislike the bright yellow |
I'd prefer that over these groupthere hacks. :> I can confirm that it works. And I have no strong opinion about having colored EXAMPLE sections (including all common text) or not. I hope that someone else decides. |
The highlighting in the screenshot is somewhat random. So it looks impressive at a glance, but adds noise to the non-code text. To avoid false positives, maybe don't highlight lines that start with a |
I changed my mind and actually prefer the way the PR currently works now. Because having an extra syntax group |
ea48ce1
to
efa1214
Compare
FEATURES: 07499a8 #8709 man.vim: C highlighting for EXAMPLES section 07f82ad #8699 TUI: urxvt: also send xterm focus-reporting seqs 40911e4 #8616 API: emit nvim_buf_lines_event from :terminal c46997a #8546 fillchars: Add "eob" flag FIXES: 74d19f6 #8576 startup: avoid blank stdin buffer if other files were opened 4874214 #8737 Only waitpid() for processes that we care about cd6e7e8 #8743 Check all child processes for exit in SIGCHLD handler c230ef2 #8746 channel.c: Prevent channel_destroy_early() from freeing uninitialized rpc stuff 0ed8b12 #8681 transstr_buf: fix length comparison d241f27 #8708 TUI: Fix standout mode 9afed40 #8698 man.vim: fix for mandoc e889640 #8682 provider/node: npm --loglevel silent 1cbc830 #8613 API: nvim_win_set_cursor: set curswant bf6048e #8628 checkhealth: Python: fix VIRTUAL_ENV check 3cc3506 #8528 checkhealth: node.js: also search yarn CHANGES: b751449 #8619 defaults: shortmess+=F 1248178 #8578 highlight: high-priority CursorLine if fg is set. 01570f1 #8726 terminal: handle &confirm and :confirm on unloading 56065bb #8721 screen: truncate showmode messages bf2460e #7551 buffer: fix copying :setlocal options c1c14fa #8520 Ex mode: always "improved" (gQ) 050f397 #7992 options: remove 'maxcombine` option (always 6) INTERNAL: 463da84 #7992 screen: use UTF-8 representation
@gravndal You mean the "Program source" header isn't highlighted? Otherwise I don't see a problem. |
Example code for c++ manpages (e.g |
@justinmk No meaning that The highlighting of the last line is also somewhat sporadic, though that doesn't have anything to do with this pull as far as I can tell. |
@gravndal Your very last screenshot shows what looks like the desired syntax highlighting. If bigger screen or scrolling degrades the experience, it's most likely a syntax performance issue, not related to this PR. you can try:
also try |
@justinmk Tried that, it doesn't change anything. What does however is putting the cursor on top of one of the brackets in the example code, the result being highlighting up and until the matching bracket. Doing a (also tried without my config too rule out anything to do with non defaults, yields the same result) |
Can't reproduce. In any case, this PR was a "best effort". As long as it didn't seriously regress anything, please send improvements in the form of a PR. It's not clear from the images if anything seriously regressed. |
So playing around with it a bit more, I'd say it's the sentence check. Adding a dot after |
That makes sense. Since a |
@Synray it might be best to check if there is a line immediately below the title-cased match. If not, then it's probably not a sentence. |
As far as I can tell by the defaults laid out in |
In that case then they should be highlighted as sub headings. I'll make the change. |
FEATURES: 07499a8 neovim#8709 man.vim: C highlighting for EXAMPLES section 07f82ad neovim#8699 TUI: urxvt: also send xterm focus-reporting seqs 40911e4 neovim#8616 API: emit nvim_buf_lines_event from :terminal c46997a neovim#8546 fillchars: Add "eob" flag FIXES: 74d19f6 neovim#8576 startup: avoid blank stdin buffer if other files were opened 4874214 neovim#8737 Only waitpid() for processes that we care about cd6e7e8 neovim#8743 Check all child processes for exit in SIGCHLD handler c230ef2 neovim#8746 channel.c: Prevent channel_destroy_early() from freeing uninitialized rpc stuff 0ed8b12 neovim#8681 transstr_buf: fix length comparison d241f27 neovim#8708 TUI: Fix standout mode 9afed40 neovim#8698 man.vim: fix for mandoc e889640 neovim#8682 provider/node: npm --loglevel silent 1cbc830 neovim#8613 API: nvim_win_set_cursor: set curswant bf6048e neovim#8628 checkhealth: Python: fix VIRTUAL_ENV check 3cc3506 neovim#8528 checkhealth: node.js: also search yarn CHANGES: b751449 neovim#8619 defaults: shortmess+=F 1248178 neovim#8578 highlight: high-priority CursorLine if fg is set. 01570f1 neovim#8726 terminal: handle &confirm and :confirm on unloading 56065bb neovim#8721 screen: truncate showmode messages bf2460e neovim#7551 buffer: fix copying :setlocal options c1c14fa neovim#8520 Ex mode: always "improved" (gQ) 050f397 neovim#7992 options: remove 'maxcombine` option (always 6) INTERNAL: 463da84 neovim#7992 screen: use UTF-8 representation
I added a new region for Example sections because those sections are usually a page long, while Synopsis sections are usually a few lines. This should only sync to the start of
EXAMPLE[S]
I'm not sure if
group[t]here
works.You can see it in action on all man pages with Example sections with this shell command:
MANPAGER="nvim -c 'set ft=man' -" man -IKs 0:2:3 EXAMPLE