fdschmidt93 / telescope-egrepify.nvim

Variable user customization for telescope.live_grep to set rg flags on-the-fly
MIT License
122 stars 13 forks source link

Telescope resume can break egrepify #21

Closed otavioschwanck closed 1 year ago

otavioschwanck commented 1 year ago

Description

when i try to search something with egrepify, stop, and use resume afterwards, the search results just breaks if i try to search the same thing again or something else.

telescope egrepify resume

Neovim version

nvim --version
NVIM v0.9.2
Build type: Release
LuaJIT 2.1.0-beta3

    arquivo vimrc de sistema: "$VIM/sysinit.vim"
            padrão para $VIM: "/opt/homebrew/Cellar/neovim/0.9.2/share/nvim"

Operating system and version

macOS 14

Steps to reproduce

  1. Search something
  2. close the picker
  3. resume the picker
  4. erase and search for the same thing.

Expected behavior

the search should work like a new spawned one

Actual behavior

the search results are different

Minimal config

-------------------------------------------------------------------------------
-- Options
-------------------------------------------------------------------------------
vim.opt.number = true
vim.opt.cursorline = true
vim.opt.smartindent = true
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.laststatus = 3
vim.opt.cmdheight = 0
vim.opt.numberwidth = 4
vim.opt.signcolumn = "yes"

-------------------------------------------------------------------------------
-- Keymap
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Bootstrap Package Manager
-------------------------------------------------------------------------------
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    print("Installing 'folke/lazy.nvim'...")
    vim.fn.system({ "git", "clone", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.rtp:prepend(lazypath)

-------------------------------------------------------------------------------
-- Plugins
-------------------------------------------------------------------------------
require("lazy").setup({
    {
        "nvim-telescope/telescope-fzf-native.nvim",
        build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
    },
    {
        "fdschmidt93/telescope-egrepify.nvim",
        keys = {
            { "<C-p>", "<CMD>Telescope egrepify<CR>", mode = { "n", "i", "v" } },
            { "<C-s>", function () 
        vim.cmd("Telescope egrepify")
        vim.cmd("norm ichar")
      end, mode = { "n", "i", "v" } },
        },
    },
  { "catppuccin/nvim", name = "catppuccin", priority = 1000 },
    {
        "nvim-telescope/telescope.nvim",
        dependencies = "nvim-lua/plenary.nvim",
        config = function()
            require("telescope").setup({
        defaults = {
          sorting_strategy = "ascending",
          layout_config = {
            horizontal = {
              prompt_position = "top",
            },
            vertical = {
              prompt_position = "top",
            },
          },
        },
                extensions = {
          egrepify = {
            filename_hl = "@attribute",
            lnum_hl = "CursorLineNr",
          },
                    fzf = {
                        fuzzy = true,
                        override_generic_sorter = true,
                        override_file_sorter = true,
                    },
                },
            })

            require("telescope").load_extension("egrepify")
            require("telescope").load_extension("fzf")
        end,
    },
})

vim.cmd("colorscheme catppuccin")
fdschmidt93 commented 1 year ago

I'm quite sure this is a problem with your config. Please always use the official minimal config since your screencast obviously is not a minimal one.

Copy & paste the one from the issue template and do nvim -nu minimal_init.lua and reproduce your issue.

I'm sorry to have to double down on this. Future issues that do not use the provided minimal init lua will be closed.

There are a few issues with :Telescope resume that are only tangentially related to what you've reported. It generally works for me. I'll merge a PR shortly that addresses the key problems.