4

I want to exclude package-lock.json and lazy-lock.json on telescope but I cant make it work. Both files are not included in .gitignore but I don't want to search on them. This my config for telescope

telescope.setup({
    defaults = {
        prompt_prefix = "❯ ",
        selection_caret = "❯ ",
        file_ignore_patterns = {
            "node_modules/.*",
            "%.env",
            "yarn.lock",
            "package-lock.json",
            "lazy-lock.json",
            "init.sql",
            "target/.*",
            ".git/.*",
        },
        mappings = {
            n = {
                ["<M-p>"] = act_layout.toggle_preview,
            },
            i = {
                ["<esc>"] = act.close,
                ["<M-p>"] = act_layout.toggle_preview,
                ["<C-h>"] = "which_key",
            },
        },
    },
    pickers = {
        buffers = {
            mappings = {
                i = {
                    ["<C-d>"] = act.delete_buffer + act.move_to_top,
                },
            },
        },
    },
    extensions = {
        file_browser = {
            path = "%:p:h",
        },
    },
})

But its still keep search on *-lock.json. What is the correct way to exclude it?

1 Answer 1

4

The dash in the string is interpreted as quantifier so I need to escape them. For example the package-lock.json should be package%-lock.json.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.