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

Preview windows show wrong position of file #42

Closed mrbeardad closed 1 month ago

mrbeardad commented 4 months ago

Description

Preview windows display wrong position of some files when first select them, and preview window display correctly when selecting it for the second time

https://github.com/fdschmidt93/telescope-egrepify.nvim/assets/54128430/fef3750d-796b-471d-835c-be26d9c4dcdc

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"

Run :checkhealth for more info

Operating system and version

Windows 11

Steps to reproduce

  1. nvim
  2. <space>/
  3. init =
  4. <c-n>

Expected behavior

Preview window should display the matched line

Actual behavior

Preview window should display top of some files when first select them.

Minimal config

-- init.lua
-- Bootstrap plugins manager
local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazy_path) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--branch=stable",
    "https://github.com/folke/lazy.nvim.git",
    lazy_path,
  })
end
vim.opt.rtp:prepend(lazy_path)

-- Load user configs before load plugins
require("user.configs")
-- vim.g.mapleader = " "

require("lazy").setup({
  -- Load plugin specifics in directories
  spec = {
    { import = "user/plugins" },
    { import = "user/langs" },
    -- { import = "user/test" },
  },
  install = {
    -- Try to load one of these colorschemes when starting an installation during startup
    colorscheme = { "tokyonight", "catppuccin", "habamax" },
  },
  change_detection = {
    -- Do not automatically check for config file changes and reload the ui
    enabled = false,
  },
  performance = {
    rtp = {
      disabled_plugins = {
        "gzip",
        "matchit",
        "matchparen",
        "netrwPlugin",
        "tarPlugin",
        "tohtml",
        "tutor",
        "zipPlugin",
      },
    },
  },
})

-- lua/user/test/egrepify.lua
return {
  {
    "nvim-telescope/telescope.nvim",
    opts = {},
  },
  -- Better live_grep that could change rg arguments on fly
  {
    "fdschmidt93/telescope-egrepify.nvim",
    keys = {
      { "<Leader>/", "<Cmd>Telescope egrepify<CR>", desc = "Search Text" },
    },
    config = function()
      require("telescope").load_extension("egrepify")
    end,
  },
}