nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.06k stars 816 forks source link

Telescope open_files not working after the initial opening #2660

Closed Nikola-Milovic closed 10 months ago

Nikola-Milovic commented 11 months ago

Description

Basically, a week or two ago, I updated all of the plugins, and suddenly I started getting this weird behaviour where, if I use <leader>ff which is mapped to find_files, after initially going into a file, I cannot open find_files again.

https://github.com/nvim-telescope/telescope.nvim/assets/50072027/3ed783f2-e864-4dcd-a1a5-d0062ae912f3

Command that I am running

local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})

I get no error messages or logs out, please do ask to provide more info, since I have no idea how to debug this.

Neovim version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Ubuntu 20.04

Telescope version / branch / rev

branch master - commit 313d2ea

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 11.0.2
- OK fd: found fd 7.4.0

===== Installed extensions ===== ~

Telescope Extension: `git_worktree` ~
- No healthcheck provided

Telescope Extension: `ui-select` ~
- No healthcheck provided

Steps to reproduce

Not sure if you can reproduce it, but my dotfiles are here, I use the lazy plugin manager.

Expected behavior

To open it without issues

Actual behavior

I cannot open it after the initial load

Minimal config

I'll try and get a reproducable demo in a VM when I get the chance
pogopaule commented 11 months ago

Same here, experiencing this problem for some days now.

Nikola-Milovic commented 11 months ago

@pogopaule Did you find a workaround that works for you?

pogopaule commented 11 months ago

@Nikola-Milovic Yes, I restructured my lazy config. Somehow that solved it. Check out my dotfiles. Can’t send a link from mobile right now.

jamestrew commented 11 months ago

Yeah this seems like it might be a configuration issue. I won't be able to debug everyone's nvim config so it'd be appreciated and more actionable if the issue is able to be replicated with minimal changes to the minimal config present in the issue template (repeated below):

 vim.cmd [[set runtimepath=$VIMRUNTIME]]
 vim.cmd [[set packpath=/tmp/nvim/site]]
 local package_root = '/tmp/nvim/site/pack'
 local install_path = package_root .. '/packer/start/packer.nvim'
 local function load_plugins()
   require('packer').startup {
     {
       'wbthomason/packer.nvim',
       {
         -- "nvim-telescope/telescope.nvim",
         '/home/jt/projects/telescope.nvim',
         requires = {
           'nvim-lua/plenary.nvim',
           { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
         },
       },
       -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
     },
     config = {
       package_root = package_root,
       compile_path = install_path .. '/plugin/packer_compiled.lua',
       display = { non_interactive = true },
     },
   }
 end
 _G.load_config = function()
   require('telescope').setup()
   require('telescope').load_extension('fzf')
   -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
 end
 if vim.fn.isdirectory(install_path) == 0 then
   print("Installing Telescope and dependencies.")
   vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
 end
 load_plugins()
 require('packer').sync()
 vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

With this config, you can just run nvim -u minimal_config.lua (may take a couple of relaunches) and test whether the issue is still reproducible without needing to set up a vm or anything.

Nikola-Milovic commented 11 months ago

@jamestrew Thanks for the response, I am 99% sure its due to lazy.nvim package manager, and misconfiguration there. Since I updated to it 2 weeks ago and this issue started coming up. I'll see if I can recreate it

nv-hwoo commented 10 months ago

@Nikola-Milovic I was having the same problem. Were you by any chance specifying buffer = true when defining key map for telescope? For instance:

vim.keymap.set('n', '<leader>ff', '<cmd>Telescope find_files<CR>', { buffer = true, noremap = true })

I was doing this, and this ended up making the mapping buffer-local, which I suspect made it disappear once I moved on to different buffer. The problem was resolved once I removed the buffer = true.

Nikola-Milovic commented 10 months ago

@nv-hwoo thanks for the heads up, I moved to lazynvim in the meantime so the problem is resolved, but I checked my commits and I didn't have buffer = true in my config :/