Skip to content

Specific fold settings can mangle telescope results #3629

@ciara-uob

Description

@ciara-uob

Description

I have foldmethod=indent and foldlevelstart=0 in my config, and this causes the telescope results buffer to break. My workaround right now is an autocommand that sets foldmethod=manual for the TelescopeResults filetype.

Update: I missed something. It was in fact the combination of shiftwidth=0 (uses tabstop instead) and foldmethod=indent that was causing the issue.

Neovim version

NVIM v0.11.6
Build type: RelWithDebInfo
LuaJIT 2.1.1772619647

Operating system and version

Arch Linux (Last system update around 13/03/2026)

Telescope version / branch / rev

master

checkhealth telescope

telescope:                                                                1 ⚠️

Checking for required plugins ~
- ✅ OK plenary installed.

Checking external dependencies ~
- ✅ OK rg: found ripgrep 15.1.0
- ⚠️ WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

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

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

Steps to reproduce

  1. nvim -nu minimal.lua in a directory with a lot of files
  2. :Telescope find_files (or any telescope with a lot of results)
  3. Hold to scroll several lines down, then to scroll back up

Expected behavior

No folding should occur in the TelescopeResults buffer.

Actual behavior

Lines seem to be folded at random (despite not actually being indented) as they are scrolled by, eventually hiding all but 3 results.

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()
      -- Problematic fold settings
      vim.o.foldmethod = "indent"
      vim.o.foldlevelstart = 0
      vim.o.foldlevel = 0
      vim.o.shiftwidth = 0
      
      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