-
-
Notifications
You must be signed in to change notification settings - Fork 836
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
preview flag does not get overriden (for find_files picker) #3325
Comments
Maybe this has something to do with inheriting the values. I read somewhere that the behavior isn't well documented yet. |
This is a lazy.nvim usage error. You need to put the |
Sorry, I made a typo in the minimal reproduction file. I meant the |
@jamestrew I tested the minmal config on my device and it reproduced the bug. Please reopen this issue. |
Ok I haven't had a chance to try myself but I'll try to take a look. |
According to `:h telescope.defaults.preview`, we should be able to do `preview=false` to disable the previewer for pickers. With how picker options resolve inheritance, something like this should work. ```lua require('telescope').setup { defaults = { preview = true }, pickers = { find_files = { preview = false } } } ``` Here, find_files should not show a previewer but it previously would. Corrects this by checking if `opts.preview` is explicitly set to `false`. In which case, we won't show the previewer. Closes nvim-telescope#3325
I think the above PR will fix this. |
Tried the PR with my own config. It fixes the issue that preview couldn't be overriden from the pickers section. But I also have a custom picker which I create via I also think that this might be a more systemic issue and that just fixing it for the |
I have to add that |
I just don't understand why |
Do you have an example of this I can see? I'm trying this rudimentary vim.keymap.set("n", "<space>f", function()
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local make_entry = require("telescope.make_entry")
local conf = require("telescope.config").values
local files = vim.trim(vim.system({ "fd", "-tf" }):wait().stdout)
files = vim.split(files, "\n")
local opts = { preview = false }
pickers
.new(opts, {
prompt_title = "colors",
finder = finders.new_table({
results = files,
entry_maker = make_entry.gen_from_file(opts),
}),
previewer = conf.file_previewer(opts),
sorter = conf.generic_sorter(opts),
})
:find()
end) |
I'll try to reproduce the bug in a more minimal setup and post the config here. |
Steps to reproduce
Minimal configlocal 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.uv.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 = {
{
"jamestrew/telescope.nvim",
branch = "preview-opt-inheritance",
keys = {
{
-- This seems fixed.
"<Space>f",
function()
require("telescope.builtin").find_files()
end,
},
-- This does not.
"<Space>H",
},
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
defaults = { preview = true },
pickers = { find_files = { preview = false } },
},
config = function(_, opts)
local telescope = require("telescope")
telescope.setup(opts)
local conf = require("telescope.config").values
vim.keymap.set("n", "<Space>H", function()
local files = vim.split(vim.trim(vim.system({ "fd", "-tf" }):wait().stdout), "\n")
-- FIXME: global preview option still can't be overridden here
require("telescope.pickers")
.new({
preview = false,
}, {
preview = false,
prompt_title = "Harpoon",
-- layout_strategy = "center",
finder = require("telescope.finders").new_table({
results = files,
-- I tried this, but it didn't change anything and I didn't need it before.
-- entry_maker = require("telescope.make_entry").gen_from_file({ preview = false }),
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
})
:find()
end)
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
}) |
@jamestrew could you reproduce the issue with my minimal config? |
Description
When using
to setup telescope, the find_files picker still shows a preview. I also tried passing
preview = false
directly into thefind_files
function, but that didn't work either.Neovim version
Operating system and version
Arch Linux x86_64
Telescope version / branch / rev
master
checkhealth telescope
Steps to reproduce
nvim -nu minimal.lua
<Space>f
Expected behavior
I expected the find_files picker to not show a preview.
Actual behavior
The find_files picker showed a preview.
Minimal config
The text was updated successfully, but these errors were encountered: