Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Cursor position doesn't auto align on directory enter when ../ (parent directory) item is shown #536

Open
3 tasks done
johnpgr opened this issue Dec 11, 2024 · 2 comments
Labels
bug Something isn't working P2 Not a priority. PRs welcome

Comments

@johnpgr
Copy link

johnpgr commented Dec 11, 2024

Did you check the docs and existing issues?

  • I have read the docs
  • I have searched the existing issues

Neovim version (nvim -v)

v0.10.2

Operating system/version

Ubuntu 24.04.1 LTS

Describe the bug

When first entering a directory in Oil, the cursor gets automatically positioned to the first file name start.
That doesn't happen if the hidden files are enabled, because the first file is now ../ (parent directory)

How it behaves with hidden files disabled

Demo.1.mp4

How it behaves with hidden files enabled

Demo.2.mp4

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

  1. toggle hidden files
  2. navigate between directories

Expected Behavior

The cursor position on first directory enter should have a consistent behavior with hidden files enabled.

Directory structure

any directory structure

Repro

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"--single-branch",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	"folke/tokyonight.nvim",
	{
		"stevearc/oil.nvim",
		config = function()
			require("oil").setup({
				columns = {
					"permissions",
					"size",
					"ctime",
					"icon",
				},
			})
		end,
	},
	-- add any other plugins here
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Did you check the bug with a clean config?

  • I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
@johnpgr johnpgr added the bug Something isn't working label Dec 11, 2024
@stevearc stevearc added the P2 Not a priority. PRs welcome label Dec 21, 2024
@BozeBro
Copy link
Contributor

BozeBro commented Jan 8, 2025

I cannot seem to reproduce based off of your repro.lua file. I do not

With hidden files off
Screenshot 2025-01-07 at 7 55 55 PM

With hidden files on

Screenshot 2025-01-07 at 7 56 14 PM

I tried on both Ubuntu and macOS

@johnpgr
Copy link
Author

johnpgr commented Jan 9, 2025

Yes, I apologize, I did forgot to add the options that I use, that causes this bug. I edited the repro.lua config.
The bug should now be reproduceable.
It's due to me using the plugin for so much time with the additional columns now that I forgot that they are not a default in oil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 Not a priority. PRs welcome
Projects
None yet
Development

No branches or pull requests

3 participants