tpope / vim-sleuth

sleuth.vim: Heuristically set buffer options
https://www.vim.org/scripts/script.php?script_id=4375
1.92k stars 86 forks source link

Error "substitute nesting too deep" with editorconfig file #95

Closed philippemilink closed 2 months ago

philippemilink commented 3 months ago

Hello,

At the root of a project, I have the following editorconfig:

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

[{*.{c,cpp,h,h.in,cu,cl,hip,f90,java,sh,sh.in,mk,gp},Makefile,Makefile.*}]
trim_trailing_whitespace = true
indent_style = tab
indent_size = 8

When I open a file with this content:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    printf("Parent process\n");

    pid_t pid = fork();
    if (pid == -1)
    {
        printf("Error in fork\n");
        return EXIT_FAILURE;
    }

    if (pid == 0)
    {
        printf("I'm the new child process\n");
    }
    else
    {
        printf("Still the old parent process\n");
    }

    sleep(10);

    return EXIT_SUCCESS;
}

I get the following error:

Error detected while processing BufRead Autocommands for "*"..function <SNR>25_AutoInit[1]..<SNR>25_Init[15]..<SNR>25_DetectDeclared[19]..<SNR>25_DetectEditorConfig[21]..<SNR>25_ReadEditorConfig[27]..<SNR>25_FnmatchTranslate[1]..<SNR>25_FnmatchReplace[8]..<SNR>25_FnmatchTranslate[1
]..<SNR>25_FnmatchReplace[8]..<SNR>25_FnmatchTranslate:
line    1:
E1290: substitute nesting too deep
E1290: substitute nesting too deep
Error detected while processing BufRead Autocommands for "*"..function <SNR>25_AutoInit[1]..<SNR>25_Init[15]..<SNR>25_DetectDeclared:
line   19:
E714: List required

The problem disappear if I comment the following two lines: https://github.com/tpope/vim-sleuth/blob/1cc4557420f215d02c4d2645a748a816c220e99b/plugin/sleuth.vim#L500-L501


With Vim 9.0 on Debian 12.