Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Not able to search with / when using wilder.nvim #561

Closed
3 tasks done
kiyoon opened this issue Feb 17, 2023 · 0 comments · Fixed by #563
Closed
3 tasks done

bug: Not able to search with / when using wilder.nvim #561

kiyoon opened this issue Feb 17, 2023 · 0 comments · Fixed by #563
Labels
bug Something isn't working

Comments

@kiyoon
Copy link

kiyoon commented Feb 17, 2023

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.0 commit 371a74e4e

Operating system/version

Ubuntu 22.04

Describe the bug

The Lazy popup closes when using with wilder.nvim.

I personally love this plugin especially the fuzzy searching part. Other popup menu like Mason didn't have this problem, but with lazy.nvim the popup automatically closes.

I appreciate your help in advance!

Steps To Reproduce

  1. :Lazy
  2. /search_string
  3. Lazy popup closes

Expected Behavior

Lazy popup should remain open

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
  -- wilder
  {
    "gelguy/wilder.nvim",
    build = ":UpdateRemotePlugins",
    dependencies = {
      {
        "romgrk/fzy-lua-native",
        build = "make",
      },
    },
    event = "CmdlineEnter",
    config = function()
      local wilder = require "wilder"
      wilder.setup { modes = { ":", "/", "?" } }

      wilder.set_option("pipeline", {
        wilder.branch(
          wilder.python_file_finder_pipeline {
            file_command = function(ctx, arg)
              if string.find(arg, ".") ~= nil then
                return { "fd", "-tf", "-H" }
              else
                return { "fd", "-tf" }
              end
            end,
            dir_command = { "fd", "-td" },
            -- filters = { "cpsm_filter" },
          },
          wilder.substitute_pipeline {
            pipeline = wilder.python_search_pipeline {
              skip_cmdtype_check = 1,
              pattern = wilder.python_fuzzy_pattern {
                start_at_boundary = 0,
              },
            },
          },
          wilder.cmdline_pipeline {
            fuzzy = 2,
            fuzzy_filter = wilder.lua_fzy_filter(),
          },
          {
            wilder.check(function(ctx, x)
              return x == ""
            end),
            wilder.history(),
          },
          wilder.python_search_pipeline {
            pattern = wilder.python_fuzzy_pattern {
              start_at_boundary = 0,
            },
          }
        ),
      })

      local gradient = {
        "#f4468f",
        "#fd4a85",
        "#ff507a",
        "#ff566f",
        "#ff5e63",
        "#ff6658",
        "#ff704e",
        "#ff7a45",
        "#ff843d",
        "#ff9036",
        "#f89b31",
        "#efa72f",
        "#e6b32e",
        "#dcbe30",
        "#d2c934",
        "#c8d43a",
        "#bfde43",
        "#b6e84e",
        "#aff05b",
      }

      for i, fg in ipairs(gradient) do
        gradient[i] = wilder.make_hl("WilderGradient" .. i, "Pmenu", { { a = 1 }, { a = 1 }, { foreground = fg } })
      end

      local highlighters = wilder.highlighter_with_gradient {
        wilder.pcre2_highlighter(),
        wilder.lua_fzy_highlighter(),
      }

      local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
        pumblend = 20,
        border = "rounded",
        empty_message = wilder.popupmenu_empty_message_with_spinner(),
        highlighter = highlighters,
        left = {
          " ",
          wilder.popupmenu_devicons(),
          wilder.popupmenu_buffer_flags {
            flags = " a + ",
            icons = { ["+"] = "", a = "", h = "" },
          },
        },
        right = {
          " ",
          wilder.popupmenu_scrollbar(),
        },
        highlights = {
          --accent = wilder.make_hl('WilderAccent', 'Pmenu', {{a = 1}, {a = 1}, {foreground = '#f4468f'}}),
          gradient = gradient,
        },
      })

      local wildmenu_renderer = wilder.wildmenu_renderer {
        highlighter = highlighters,
        separator = " · ",
        left = { " ", wilder.wildmenu_spinner(), " " },
        right = { " ", wilder.wildmenu_index() },
        highlights = {
          -- accent = wilder.make_hl("WilderAccent", "Pmenu", { { a = 1 }, { a = 1 }, { foreground = "#f4468f" } }),
          gradient = gradient,
        },
        apply_incsearch_fix = true,
      }

      wilder.set_option(
        "renderer",
        wilder.renderer_mux {
          [":"] = popupmenu_renderer,
          ["/"] = wildmenu_renderer,
          substitute = wildmenu_renderer,
        }
      )
    end,
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme "tokyonight"
-- add anything else here
@kiyoon kiyoon added the bug Something isn't working label Feb 17, 2023
@folke folke closed this as completed in 7339145 Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant