nvim-telescope / telescope.nvim

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

Calling find_files closes telescope gui and immediately puts me in insert mode #1446

Closed chuygil closed 3 years ago

chuygil commented 3 years ago

Description

When calling find_files the prompt/preview gui closes really fast and puts me in insert mode.

Neovim version

NVIM v0.6.0-dev+569-g2ecf0a4c6 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

Operating system and version

Fedora Workstation 35

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 13.0.0
  - OK: fd: found fd 8.2.1

## ===== Installed extensions =====

Steps to reproduce

  1. nnoremap <leader>ff <cmd>Telescope find_files<cr>

Lua config setup;

local actions = require('telescope.actions')

require('telescope').setup {
  defaults = {
    file_sorter = require('telescope.sorters').get_fzy_sorter,

    file_previewer   = require('telescope.previewers').vim_buffer_cat.new,
    grep_previewer   = require('telescope.previewers').vim_buffer_vimgrep.new,
    qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,
    mappings = {
      i = {
        -- Also close on Esc in insert mode
        ["<esc>"] = actions.close,
        ["<C-[>"] = actions.close,
        ["<C-q>"] = actions.send_to_qflist,
      },
    },
    file_ignore_patterns = {
      "node_modules",
      "env/.*",
      ".git/.*"
    },
  },
}

Expected behavior

Open up find_files prompt/preview gui

Actual behavior

When calling find_files the prompt/preview gui closes really fast and puts me in insert mode.

https://user-images.githubusercontent.com/59382692/141358354-9d1af2a8-ede3-4bc7-b97d-7879eca38134.mp4

Minimal config

# init.vim
`nnoremap <leader>ff <cmd>Telescope find_files<cr>`

# init.lua

local actions = require('telescope.actions')

require('telescope').setup {
  defaults = {
    file_sorter = require('telescope.sorters').get_fzy_sorter,

    file_previewer   = require('telescope.previewers').vim_buffer_cat.new,
    grep_previewer   = require('telescope.previewers').vim_buffer_vimgrep.new,
    qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,
    mappings = {
      i = {
        -- Also close on Esc in insert mode
        ["<esc>"] = actions.close,
        ["<C-[>"] = actions.close,
        ["<C-q>"] = actions.send_to_qflist,
      },
    },
    file_ignore_patterns = {
      "node_modules",
      "env/.*",
      ".git/.*"
    },
  },
}
fdschmidt93 commented 3 years ago

Maybe another member has an idea, but I cannot immediately see as to why that would happen.

Does this issue also occur with the minimal_init.lua? We have the minimal config for especially such cases.

nvim -nu minimal_init.lua and then of course :Telescope find_files.

-- minimal_init.lua
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',
        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()]]
chuygil commented 3 years ago

I will try the minimal config. I have attached a video, hope this helps.

fdschmidt93 commented 3 years ago

Closing this because I'm quite confident that this is more of a user config issue and I've gotten no response to as to whether it works with minimal init or not.

Please let me know if there's more we can do. Happy to reopen in that case.

polak-jan commented 3 years ago

I am getting more or less the same issue. My Telescope my configuration is the default, only Telescope related changes are some mappings. But find_files works just fine for me, instead I am getting the same behaviour with soem of the "symbols" related pickers, specifically symbols and lsp_workspace_symbols, while lsp_document_symbols and lsp_dynamic_workspace_symbols work just fine. I don't think the issue is LSP, the config is just the default lspconfig, because other LSP pickers work just fine. Tested this with gopls and tsserver.

fdschmidt93 commented 3 years ago

Please open an issue that provides a repro with the minimal config above and lspconfig. Most of these issues stem from the fact that you have some plugin or setting or interaction that materially interferes.

polak-jan commented 3 years ago

My config is still written in Vim script, so I am not sure what to do with the issue wizard which is asking for a Lua config. Is Vim script no supported anymore? I am able to repro the issue even with just the following:

call plug#begin()

Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'

call plug#end()

lua << EOF

require'lspconfig'.gopls.setup{}
require'lspconfig'.tsserver.setup{}
require'telescope'.setup{}

EOF
fdschmidt93 commented 3 years ago

Vimscript is supported. In any case, please don't hijack other issues and fill out the full form (incl nvim version, health check, everything).

chuygil commented 3 years ago

Closing this because I'm quite confident that this is more of a user config issue and I've gotten no response to as to whether it works with minimal init or not.

Please let me know if there's more we can do. Happy to reopen in that case.

I apologize for the late response. It works fine with the minimal config. I'm pretty sure its something with my nvim-cmp config, haven't have this issue since I disabled it. Anyways, I appreciate the help!