[vim/vim] reStructuredText Syntax Highlighting on macOS (Issue #13779)

37 views
Skip to first unread message

Xudong Zheng

unread,
Dec 26, 2023, 12:58:58 PM12/26/23
to vim/vim, Subscribed

Steps to reproduce

The bug can be reproduced with the following command using macOS's builtin Vim.

echo "syntax on" > vimrc
echo "hello CONFIG_SAMPLE_BT_USE_AUTHENTICATION" > test.rst
vim -u vimrc test.rst

This results in 'redrawtime' exceeded, syntax highlighting disabled.

It's hard to say how much of this is a Vim bug and not a macOS issue since I haven't been able to reproduce with similar Vim versions on Debian/etc.

Expected behaviour

Syntax highlighting should work

Version of Vim

9.0.2018

Environment

Operating System: macOS 14.2.1

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 12 2023 01:16:04)
macOS version - arm64
Included patches: 1-2018

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779@github.com>

Christian Brabandt

unread,
Dec 27, 2023, 12:22:13 PM12/27/23
to vim/vim, Subscribed

Hm, I cannot reproduce but then I do not have a mac. Two things:
If you compile your own version (e.g. using homebrew), does it show the same issue? What is your option 'redrawtime' value? Can you use :syntime report and check if there are slow queries (See :h syntime) ? Also, can you please post the full :version output?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/1870491312@github.com>

Xudong Zheng

unread,
Dec 27, 2023, 5:08:03 PM12/27/23
to vim/vim, Subscribed

I have the default redrawtime=2000. syntime unfortunately isn't available in the OS Vim.

I will look into trying a custom compiled Vim but I suspect it's due to the way Apple is compiling it. The issue is present with the default Vim on macOS 12 and macOS 14 but I haven't been able to reproduce the issue on any of my Linux boxes running a variety of Vim versions.

:version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 12 2023 01:16:04)
macOS version - arm64
Included patches: 1-2018
Compiled by ro...@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               +cmdline_hist      +ex_extra          +jumplist          +mouse_dec         -perl              -sodium            +textobjects       +wildmenu
-arabic            +cmdline_info      +extra_search      -keymap            -mouse_gpm         +persistent_undo   -sound             +textprop          +windows
+autocmd           +comments          -farsi             +lambda            -mouse_jsbterm     +popupwin          +spell             +timers            +writebackup
+autochdir         +conceal           +file_in_path      -langmap           +mouse_netterm     +postscript        +startuptime       +title             -X11
-autoservername    +cryptv            +find_in_path      +libcall           +mouse_sgr         +printer           +statusline        -toolbar           -xattr
-balloon_eval      +cscope            +float             +linebreak         -mouse_sysmouse    -profile           -sun_workshop      +user_commands     -xfontset
-balloon_eval_term +cursorbind        +folding           +lispindent        +mouse_urxvt       -python            +syntax            -vartabs           -xim
-browse            +cursorshape       -footer            +listcmds          +mouse_xterm       -python3           +tag_binary        +vertsplit         -xpm
++builtin_terms    +dialog_con        +fork()            +localmap          +multi_byte        +quickfix          -tag_old_static    +vim9script        -xsmp
+byte_offset       +diff              -gettext           -lua               +multi_lang        +reltime           -tag_any_white     +viminfo           -xterm_clipboard
+channel           +digraphs          -hangul_input      +menu              -mzscheme          -rightleft         -tcl               +virtualedit       -xterm_save
+cindent           -dnd               +iconv             +mksession         +netbeans_intg     -ruby              +termguicolors     +visual
-clientserver      -ebcdic            +insert_expand     +modify_fname      +num64             +scrollbind        +terminal          +visualextra
+clipboard         -emacs_tags        +ipv6              +mouse             +packages          +signs             +terminfo          +vreplace
+cmdline_compl     +eval              +job               -mouseshape        +path_extra        +smartindent       +termresponse      +wildignore
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/1870656897@github.com>

Xudong Zheng

unread,
Jul 20, 2024, 4:21:36 PM (2 days ago) Jul 20
to vim/vim, Subscribed

I did a bit more investigation and the issue disappears if I remove these two lines: https://github.com/vim/vim/blob/d887fb81b6d419d035629f06b918b054d30c5fab/runtime/syntax/rst.vim#L169-L170

\= seems to be responsible part - issue also goes away if I remove that.

My initial guess is that there's some difference between how regular expressions are handled on macOS vs Linux.

I am not familiar enough with these syntax files to know what can be safely removed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/2241284075@github.com>

Xudong Zheng

unread,
Jul 20, 2024, 4:27:45 PM (2 days ago) Jul 20
to vim/vim, Subscribed

I did a bit more investigation and the issue disappears if I remove these two lines: https://github.com/vim/vim/blob/d887fb81b6d419d035629f06b918b054d30c5fab/runtime/syntax/rst.vim#L169-L170

\= seems to be responsible part - issue also goes away if I remove that.

My initial guess is that there's some difference between how regular expressions are handled on macOS vs Linux.

I am not familiar enough with these syntax files to know what can be safely removed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/2241285683@github.com>

Christian Brabandt

unread,
Jul 21, 2024, 3:37:31 AM (yesterday) Jul 21
to vim/vim, Subscribed

I have no idea, why this goes away once you remove the \=. This is used to match the _ optionally at. I don't know the RST markup language, so cannot say what will break.

A few things to try:

  • Try if it changes with :set re=1 or :set re=2?
  • Can you generate the :syntime report (see :help syntime)

Also pinging @marshallward perhaps he know what this change above would mean to the RST highlighting.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/2241511563@github.com>

Marshall Ward

unread,
Jul 21, 2024, 9:34:52 AM (23 hours ago) Jul 21
to vim/vim, Subscribed

Single and double underscores should both be recognized. The double underscore indicates an anonymous hyperlink. (.. __: https:/...)

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlink-targets

This section predates me, and I'm not in a position this week to test anything, so I'm unsure what could be causing the problem. But I don't think that the \= should just be dropped.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/2241613499@github.com>

Xudong Zheng

unread,
Jul 21, 2024, 11:34:25 AM (21 hours ago) Jul 21
to vim/vim, Subscribed

@chrisbra thanks for the suggestion.

Syntax highlighting works on macOS without any runtime changes if I set :set re=0 and :set re=2.

Additionally, I'm able to reproduce the issue on all my machines with :set re=1:

echo "hello CONFIG_SAMPLE_BT_USE_AUTHENTICATION" > test.rst
vim --clean -c ":set re=1" -c ":syntax on" test.rst

It seems like re=1 is the default on macOS but :verbose set re? doesn't show anything not sure why it's different.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13779/2241680771@github.com>

Reply all
Reply to author
Forward
0 new messages