nvim-telescope / telescope.nvim

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

Since `991d5db`, opening zsh files results in empty echo-msg #2593

Open chrisgrieser opened 1 year ago

chrisgrieser commented 1 year ago

Description

Opening a zsh file (either identified via shebang, or via .zsh extension) via telescope results in something like an empty echo message, as if :echo ""<CR> was run. This is noticeable when using cmdheight=0, where opening any zsh file now results in the need to press enter an additional time. It does not matter which picker is used, the issue occurs as long as a zsh file is opened via Telescope.

I did not notice the issue with any other filetype, and it does not occur when opening zsh files with any other method.

With some bisecting, I could pin down that commit 991d5db introduced the issue; earlier commits do not have that issue. However, the commit is concerned with keymaps, and I could not figure out what exactly in that commit is affecting zsh files specifically.

Neovim version

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim"

Run :checkhealth for more info

Operating system and version

macOS 13.4.1

Telescope version / branch / rev

occurs since 991d5db

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.7.0

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

Telescope Extension: `file_browser` ~
- No healthcheck provided

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Steps to reproduce

  1. nvim -nu minimal.lua
  2. create foobar.zsh in the same directory
  3. add cmdheight=0 to the minimal.lua (strictly speaking, this is not needed, it makes the bug more apparent. Otherwise, the bug is only noticeable by an empty line when running :messages)
  4. :Telescope fd → open foobar.zsh

Expected behavior

No need to press enter after opening zsh files

Actual behavior

Need to press enter after opening zsh files

Minimal config

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()]]
--------------------------------------------------------------------------------

vim.opt.cmdheight=0
jamestrew commented 1 year ago

Hey, thanks for the report. You're right and I can replicate this at the commit and also on master/neovim nightly as well.

I don't really have any clue as to why that's happening though. Opening foobar.zsh using telescope in normal mode doesn't cause the issue despite the binds being essentially identical besides the mode.

chrisgrieser commented 1 year ago

yeah, it also puzzled me how a keymap-refactor-commit could have such an effect. could this commit maybe be reverted for the time being?

chrisgrieser commented 1 year ago

In case anyone comes finds this via search, using noice.nvim somehow suppresses the press-enter-prompt. apart from pinning a commit, this is the only workaround I have found so far for this bug