Skip to content

Telescope buffer picker resets cursor position when opening multiple files #3526

@perttuvep

Description

@perttuvep

Description

I've tried with many different autocmds but no dice.

It works just fine when changing the buffer via :e bar.c

Neovim version

NVIM v0.12.0-dev-906+g5151f635ca
Build type: RelWithDebInfo
LuaJIT 2.1.1753364724
Run "nvim -V1 -v" for more info

Operating system and version

Linux archlinux 6.16.1-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 15 Aug 2025 16:04:24 +0000 x86_64 GNU/Linux

Telescope version / branch / rev

main branch

checkhealth telescope

==============================================================================
telescope:                                                                  ✅

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

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

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

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

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

Steps to reproduce

Step 1: open two or more files nvim foo.c bar.c
Step 2: Use buffer picker to switch to other file

Expected behavior

Cursor position is restored.

Actual behavior

Cursor position is reset to 0,0.

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 = {
	{
		"mrcjkb/nvim-lastplace", -- or just autocmd for restoring position
		"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