Skip to content

opening telescope immediately when starting neovim incorrect in neovim 0.11.2 #3480

Open
@ssteinbach

Description

@ssteinbach

Description

Hi all! I have some shell aliases that open neovim and immediate drop into telescope (using the -c option in neovim). On neovim 0.11.2 the telescope UI misbehaves when used in this way, prior versions that I tested do not.

Neovim version

NVIM v0.11.2
Build type: Release
LuaJIT 2.1.1737090214

Operating system and version

macOS 15.5

Telescope version / branch / rev

tried with version ="*" and no version set in lazy

checkhealth telescope

==============================================================================
telescope:                                                                1 ⚠️

Checking for required plugins ~
- ✅ OK plenary installed.
- ⚠️ WARNING nvim-treesitter not found. (Required for `:Telescope treesitter`.)

Checking external dependencies ~
- ✅ OK rg: found ripgrep 14.1.1
- ✅ OK fd: found fd 10.2.0

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

Steps to reproduce

Minimal config:

local 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 = {
  {
    "nvim-telescope/telescope.nvim",
    branch = "master",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

function FindFiles_Func(search_from_project_root)
    local builtin = require("telescope.builtin")
    local utils = require("telescope.utils")

    local s_root = utils.buffer_dir()

    if (search_from_project_root) then
        s_root = string.gsub(vim.fn.system(
        "git rev-parse --show-toplevel"),
        "\n",
        ""
        )
        if vim.v.shell_error == 1 then
            s_root = "."
        end
    end
    builtin.find_files({cwd = s_root})
end
vim.g.mapleader = " "
vim.keymap.set(
    "n",
    "<Leader>.",
    FindFiles_Func,
    {noremap=true, desc="open filename search from CWD in telescope"}
)

Then to start neovim:

nvim -u /var/tmp/test.lua -c ":lua FindFiles_Func()"

Thanks for the great plugin!

Expected behavior

On neovim 0.11.1 and 0.11.0, after startup, vim would look like this:

Image

Typing would go into the bottom search bar field and behave correctly.

Actual behavior

After upgrading to neovim 0.11.2, it looks like this:

Image

(note that the > is missing from the input box). When typing (it is in insert mode) text goes into the "Grep Preview" box on the right instead of the search box on the bottom.

Image

Note that when running telescope after startup (ie not using the -c option) it behaves normally in 0.11.2.

I'm sure this is user error and I needed to update something in my aliases, but flagging in case someone can help me get the configuration straightened out.

Additionally, closing the telescope ui seems messed up - the best thing I can do is repeatedly run :q! to close all the dangling floating windows.

Minimal config

local 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 = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions