[vim/vim] Opening a simple tsx file with :syntax on crashes vim in macOS (Issue #17247)

31 views
Skip to first unread message

Kevin De Keyser

unread,
May 3, 2025, 5:32:58 AM5/3/25
to vim/vim, Subscribed
bvoq created an issue (vim/vim#17247)

Steps to reproduce

Use an empty vim install and open the below .tsx file and type :syntax on.
You will see that only the top of the file is highlighted and after a bit of navigation vim crashes.
This was already reported at Herrington's repository here: HerringtonDarkholme/yats.vim#292

Here's an example .tsx file.

import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
import { Devs } from "@utils/constants";
import { sleep } from "@utils/misc";
import definePlugin from "@utils/types";
import { findByPropsLazy, findStoreLazy } from "@webpack";
import { DateUtils, FluxDispatcher, MessageStore, SelectedChannelStore, Tooltip, React, useState, useStateFromStores } from "@webpack/common";
import { Message } from "discord-types/general";

const MessageActions = findByPropsLazy("fetchMessages", "sendMessage");

function getTotalReactions(message: Message): number {
    if (!message?.reactions) {
        return 0;
    }
    return message.reactions.reduce((sum, reaction) => sum + (reaction.count ?? 0), 0);
}

function getOldestMessage(channelId: string): Message | undefined {
     const messagesObj = MessageStore.getMessages(channelId);
     const currentMessages = messagesObj?._array ?? [];
     return currentMessages.reduce((oldest, msg) => {
         if (!oldest || BigInt(msg.id) < BigInt(oldest.id)) {
             return msg;
         }
         return oldest;
     }, undefined as Message | undefined);
}


const LoadAndSortButton: ChatBarButtonFactory = ({ isMainChat }) => {
    if (!isMainChat) return null;

    const [isLoading, setIsLoading] = useState(false);
    const currentChannelId = SelectedChannelStore.getChannelId();

    const oldestMessageTimestampText = useStateFromStores(
        [MessageStore, SelectedChannelStore],
        () => {
            const chanId = SelectedChannelStore.getChannelId();
            if (!chanId) return "";
            const oldestMsg = getOldestMessage(chanId);
            if (!oldestMsg) return "";
            return DateUtils.calendarFormat(oldestMsg.timestamp);
        }
    );


    const handleLoadAndSortClick = async () => {
        const channelId = SelectedChannelStore.getChannelId();
        if (!channelId || isLoading) {
            return;
        }

        if (!MessageActions?.fetchMessages) {
             return;
        }

        setIsLoading(true);

        const FETCH_LIMIT = 100;
        let fetchError = null;

        try {
            const oldestMsg = getOldestMessage(channelId);

            await MessageActions.fetchMessages({
                channelId: channelId,
                limit: FETCH_LIMIT,
                before: oldestMsg?.id,
            });

            await sleep(100);

            const messagesObj = MessageStore.getMessages(channelId);
            const messagesArray = messagesObj?._array;

            if (messagesArray && messagesArray.length > 0) {
                messagesArray.sort((a, b) => getTotalReactions(a) - getTotalReactions(b));

                 if (messagesArray.length > 0) {
                     FluxDispatcher.dispatch({
                         type: "MESSAGE_UPDATE",
                         message: messagesArray[messagesArray.length - 1],
                         logMuted: true,
                     });
                 }
            }

        } catch (error) {
            fetchError = error;
            console.error(`Failed to fetch/sort messages for channel ${channelId}:`, error);
        } finally {
            setIsLoading(false);
        }
    };

    const containerStyle: React.CSSProperties = {
        display: 'flex',
        alignItems: 'center',
        gap: '8px',
    };

    const timestampStyle: React.CSSProperties = {
        fontSize: '12px',
        color: 'var(--text-muted)',
        whiteSpace: 'nowrap',
        userSelect: 'none',
    };


    return (
        <div style={containerStyle}>
            <ChatBarButton
                tooltip={isLoading ? "Loading..." : "Load More Messages & Sort by Reactions"}
                onClick={handleLoadAndSortClick}
                disabled={isLoading}
            >
                <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style={{ transform: "scale(1.1)" }}>
                    {isLoading ? (
                        <>
                            <path d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"/>
                            <path d={`M10.72,19.9a8,8,0,0,1-6.5-9.79A7.77,7.77,0,0,1,10.4,4.16a8,8,0,0,1,9.49,6.52A1.54,1.54,0,0,0,21.38,12h.13a1.37,1.37,0,0,0,1.38-1.54,11,11,0,1,0-12.7,12.1A1.52,1.52,0,0,0,12,21.34h0A1.47,1.47,0,0,0,10.72,19.9Z`}>
                                <animateTransform attributeName="transform" type="rotate" dur="0.75s" values="0 12 12;360 12 12" repeatCount="indefinite"/>
                            </path>
                        </>
                    ) : (
                       <>
                           <path d="M4.75 8.75a.75.75 0 0 1 .75-.75h13a.75.75 0 0 1 0 1.5h-13a.75.75 0 0 1-.75-.75Zm0 4a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1-.75-.75Zm4 4a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z"/>
                           <path d="M17 12.75a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0v-6a.75.75 0 0 1 .75-.75Zm1.78 7.28a.75.75 0 0 1 0 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 1 1 1.06-1.06l1.72 1.72 1.72-1.72a.75.75 0 0 1 1.06 0Z"/>
                       </>
                    )}
                </svg>
            </ChatBarButton>
             {oldestMessageTimestampText && (
                 <span style={timestampStyle}>
                     Oldest: {oldestMessageTimestampText}
                 </span>
             )}
        </div>
    );
};

export default definePlugin({
    name: "SortByReactions",
    description: "Adds a button to the message bar. If you click it, it will load 100 more messages (Discord API limit) and sort them by reaction count. Pressing the button multiple times, will load more messages. It further displays how far back messages are loaded.",
    authors: [Devs.bvoq],
    renderChatBarButton: LoadAndSortButton,
});

Expected behaviour

Vim shouldn't crash and highlight the tsx file properly.

Version of Vim

9.1.754

Environment

Operating system: macOS
Terminal: iTerm2
Value of $TERM: xterm-256color
Shell: zsh

Logs and stack traces

—
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/17247@github.com>

Christian Brabandt

unread,
May 3, 2025, 12:45:47 PM5/3/25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17247)

It's not actually crashing, you just lost syntax highlighting, right? Can you reproduce using vim --clean ?

—
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/17247/2848706484@github.com>

Christian Brabandt

unread,
May 3, 2025, 12:46:36 PM5/3/25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17247)

Oh and please also check :h :syn-sync

—
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/17247/2848706962@github.com>

Kevin De Keyser

unread,
May 3, 2025, 4:18:23 PM5/3/25
to vim/vim, Subscribed
bvoq left a comment (vim/vim#17247)

It doesn't crash but it freezes completely.
If I run it with vim --clean I can't replicate the freezing (even though the .vimrc is empty).

—
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/17247/2848789785@github.com>

Christian Brabandt

unread,
May 4, 2025, 1:03:42 AM5/4/25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17247)

Then you need to find out what in your .vimrc is causing this

—
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/17247/2849009003@github.com>

Kevin De Keyser

unread,
May 5, 2025, 8:32:57 AM5/5/25
to vim/vim, Subscribed
bvoq left a comment (vim/vim#17247)

Both my .vim and .vimrc are empty?

—
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/17247/2850846360@github.com>

Kevin De Keyser

unread,
May 5, 2025, 8:36:53 AM5/5/25
to vim/vim, Subscribed
bvoq left a comment (vim/vim#17247)

This is the logs.

chdir(/usr/share/vim)
fchdir() to previous dir
sourcing "$VIM/vimrc"
finished sourcing $VIM/vimrc
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
could not source "$VIMRUNTIME/macmap.vim"
chdir(/Users/deke)
fchdir() to previous dir
could not source "$HOME/.vimrc"
chdir(/Users/deke/.vim)
fchdir() to previous dir
could not source "~/.vim/vimrc"
chdir(/Users/deke/.config/vim)
fchdir() to previous dir
could not source "~/.config/vim/vimrc"
chdir(/Users/deke)
fchdir() to previous dir
could not source "$HOME/.exrc"
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
sourcing "$VIMRUNTIME/defaults.vim"
finished sourcing $VIMRUNTIME/defaults.vim
not found in 'packpath': "pack/*/start/*"
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/getscriptPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/getscriptPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/gzip.vim"
finished sourcing /usr/share/vim/vim91/plugin/gzip.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/logiPat.vim"
finished sourcing /usr/share/vim/vim91/plugin/logiPat.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/manpager.vim"
finished sourcing /usr/share/vim/vim91/plugin/manpager.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/matchparen.vim"
finished sourcing /usr/share/vim/vim91/plugin/matchparen.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/netrwPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/netrwPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/rrhelper.vim"
finished sourcing /usr/share/vim/vim91/plugin/rrhelper.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/spellfile.vim"
finished sourcing /usr/share/vim/vim91/plugin/spellfile.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/tarPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/tarPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/tohtml.vim"
finished sourcing /usr/share/vim/vim91/plugin/tohtml.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/vimballPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/vimballPlugin.vim
chdir(/usr/share/vim/vim91/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/plugin/zipPlugin.vim"
finished sourcing /usr/share/vim/vim91/plugin/zipPlugin.vim
not found in 'packpath': "pack/*/start/*"
not found in 'runtimepath': "plugin/**/*.vim"
Reading viminfo file "/Users/deke/.viminfo" info oldfiles
"index.tsx" 
"index.tsx" 154L, 6015B
Reading viminfo file "/Users/deke/.viminfo" marks
Executing BufWinEnter Autocommands for "*"
autocommand autocmd SafeState * ++once call s:Highlight_Matching_Pair()

Executing BufEnter Autocommands for "*"
autocommand sil call s:LocalBrowse(expand("<amatch>"))

Executing VimEnter Autocommands for "*"
autocommand sil call s:VimEnter(expand("<amatch>"))

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing SafeState Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()


chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
sourcing "/usr/share/vim/vim91/syntax/syntax.vim"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 20: sourcing "/usr/share/vim/vim91/syntax/synload.vim"
chdir(/usr/share/vim/vim91/syntax)
fchdir() to previous dir
line 22: sourcing "/usr/share/vim/vim91/syntax/syncolor.vim"
chdir(/usr/share/vim/vim91/colors/lists)
fchdir() to previous dir
line 37: sourcing "/usr/share/vim/vim91/colors/lists/default.vim"
finished sourcing /usr/share/vim/vim91/colors/lists/default.vim
continuing in /usr/share/vim/vim91/syntax/syncolor.vim
finished sourcing /usr/share/vim/vim91/syntax/syncolor.vim
continuing in /usr/share/vim/vim91/syntax/synload.vim
finished sourcing /usr/share/vim/vim91/syntax/synload.vim
continuing in /usr/share/vim/vim91/syntax/syntax.vim
chdir(/usr/share/vim/vim91)
fchdir() to previous dir
line 26: sourcing "/usr/share/vim/vim91/filetype.vim"
not found in 'runtimepath': "ftdetect/*.vim"
finished sourcing /usr/share/vim/vim91/filetype.vim
continuing in /usr/share/vim/vim91/syntax/syntax.vim
Executing FileType Autocommands for "*"
autocommand 0verbose exe "set syntax=" . expand("<amatch>")

Executing BufRead Autocommands for "*.tsx"
autocommand setf typescriptreact

Executing FileType Autocommands for "*"
autocommand 0verbose exe "set syntax=" . expand("<amatch>")

Executing BufRead Autocommands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! scripts.vim | endif

Executing BufRead Autocommands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat    && (expand("<amatch>") =~# '\.conf$'^I|| getline(1) =~ '^#' || getline(2) =~ '^#'^I|| getline(3) =~ '^#' || getline(4) =~ '^#'^I|| getline(5) =~ '^#') |   setf FALLBACK conf | endif

finished sourcing /usr/share/vim/vim91/syntax/syntax.vim
'redrawtime' exceeded, syntax highlighting disabled
Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing WinScrolled Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Type  :qa  and press <Enter> to exit Vim
Type  :qa  and press <Enter> to exit Vim
Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

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

Christian Brabandt

unread,
May 5, 2025, 8:48:04 AM5/5/25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17247)

if your .vimrc is empty, it could still be any plugin you installed.

—
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/17247/2850884428@github.com>

arLevi

unread,
Jan 24, 2026, 2:16:13 PMJan 24
to vim/vim, Subscribed
arLevi left a comment (vim/vim#17247)

I used AI which also creates .tsx files, and to edit them I move these files to .txt edit them, then rename it back to tsx.
I use iTerm2 on MacOSX 14.8.3

When running with vim --clean the file starts with syntax highlight on - then I scroll down until it gets stuck, vim disables the syntax highlighting (black & white only) and I can continue to scrolldown, when I scroll up again - the part that was highlighted is also B&W now ... and I can scroll down & up freely.

—
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/17247/3795374832@github.com>

Eric Curtin

unread,
Feb 3, 2026, 8:42:48 AMFeb 3
to vim/vim, Subscribed
ericcurtin left a comment (vim/vim#17247)

Can confirm the same, other users have also seen this:

Strangest vim bug ever seems typescript specific, freezes when I try to open this file:

https://lnkd.in/e7dySXMm
Use Hugging Face with JavaScript. Contribute to huggingface/huggingface.js development by creating an account on GitHub.
huggingface.js/packages/tasks/src/local-apps.ts at main · huggingface/huggingface.js
github.com
like
1
4 comments
Reactions
View Suraj Variar’s graphic link
like

Like

Comment

Repost

Send
371 impressions
View analytics
Eric Curtin

Add a comment…
Open Emoji Keyboard

Current selected sort order is Most relevant
Most relevant
View Eric Curtin’s graphic link
Eric Curtin

Author
Principal Software Engineer working on AI at Docker, Inc
3h

That being said, easy temporary fix:

syntax off

Like

Reply
138 impressions
View Ryan Petrello’s graphic link
Ryan Petrello
• 1st
Principal Software Engineer
(edited)
32m

I had the same issue with my setup, adding this to my .vimrc helped:

set regexpengine=0

It seems related to vim's legacy regex engine for syntax highlighting being very slow for Typescript.

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

dkearns

unread,
Feb 3, 2026, 9:45:48 AMFeb 3
to vim/vim, Subscribed
dkearns left a comment (vim/vim#17247)

I had a quick look but I can't seem to reproduce it.

These reports should go through the upstream repo https://github.com/HerringtonDarkholme/yats.vim/.

HerringtonDarkholme/yats.vim#292 has been closed so perhaps it has been fixed, though it's not obvious from the issue.

Please report your findings here.

—
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/17247/3841760435@github.com>

Christian Brabandt

unread,
Feb 3, 2026, 10:31:54 AMFeb 3
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17247)

Also, if you believe this is related to syntax highlighting, can you please follow this guide here: :h syntime and report the syntime for your file?

—
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/17247/3842012839@github.com>

colehdlr

unread,
Sep 11, 2026, 5:44:49 AMSep 11
to vim/vim, Subscribed
colehdlr left a comment (vim/vim#17247)

For others facing this issue:
Adding set regexpengine=2 to your .vimrc will resolve the problem.

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17247/5632587848@github.com>

dkearns

unread,
Sep 11, 2026, 6:20:57 AMSep 11
to vim/vim, Subscribed
dkearns left a comment (vim/vim#17247)

Can someone try this?

diff --git a/runtime/syntax/shared/typescriptcommon.vim b/runtime/syntax/shared/typescriptcommon.vim
index 1cb1740f8..29535a145 100644
--- a/runtime/syntax/shared/typescriptcommon.vim
+++ b/runtime/syntax/shared/typescriptcommon.vim
@@ -1948,12 +1948,12 @@ syntax match   typescriptArrowFuncDef          contained /\K\k*\s*=>/
   \ nextgroup=@typescriptExpression,typescriptBlock
   \ skipwhite skipempty
 
-syntax match   typescriptArrowFuncDef          contained /(\%(\_[^()]\+\|(\_[^()]*)\)*)\_s*=>/
+syntax match   typescriptArrowFuncDef          contained /(\_[^()]*\%((\_[^()]*)\_[^()]*\)*)\_s*=>/
   \ contains=typescriptArrowFuncArg,typescriptArrowFunc,@typescriptCallSignature
   \ nextgroup=@typescriptExpression,typescriptBlock
   \ skipwhite skipempty
 
-syntax region  typescriptArrowFuncDef          contained start=/(\%(\_[^()]\+\|(\_[^()]*)\)*):/ matchgroup=typescriptArrowFunc end=/=>/
+syntax region  typescriptArrowFuncDef          contained start=/(\_[^()]*\%((\_[^()]*)\_[^()]*\)*):/ matchgroup=typescriptArrowFunc end=/=>/
   \ contains=typescriptArrowFuncArg,typescriptTypeAnnotation,@typescriptCallSignature
   \ nextgroup=@typescriptExpression,typescriptBlock
   \ skipwhite skipempty keepend

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Mime Čuvalo

unread,
Sep 12, 2026, 4:17:30 PM (13 days ago) Sep 12
to vim/vim, Subscribed
mimecuvalo left a comment (vim/vim#17247)

ran into this myself as well. @dkearns thanks for taking on, your fix looks great!

why:

  • this is an issue specifically for the macOS original system-provided vim (not via Homebrew)
  • the macOS comes with regexpengine=1 instead of the default=0
  • in runtime/syntax/shared/typescriptcommon.vim:1951 the typescriptArrowFuncDef causes a regex heavy regex backtrack

workaround (not 2 as suggested a couple comments above):

set regexpengine=0

hopefully Apple should change to the default if possible as well!

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

bvoq

unread,
Sep 23, 2026, 3:41:54 AM (2 days ago) Sep 23
to vim/vim, Subscribed
bvoq left a comment (vim/vim#17247)

I overwrote ~/.vim/syntax/shared/typescriptcommon.vim with your patch and can confirm that it is working @dkearns

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages