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

un staged files showing folded without filename by default #1294

Closed
ashish10alex opened this issue May 16, 2024 · 6 comments
Closed

un staged files showing folded without filename by default #1294

ashish10alex opened this issue May 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@ashish10alex
Copy link

ashish10alex commented May 16, 2024

Description

After the latest release v1.0.0 , when running :Neogit the un-staged files and the commits are folded by default. which is hiding the filename. I am able to run : lua vim.o.foldenable = false to bring back the expected behaviour. I assumed it must be some config change that I might have missed. I changed all the fold options to false but this only fixed the commit list folding.

Is there a config that I am missing or is this by design ?

CleanShot.2024-05-17.at.00.00.12.mp4

Neovim version

NVIM v0.10.0-dev-565+g3688735c2-Homebrew
Build type: Release
LuaJIT 2.1.1713773202

Operating system and version

macOS Sanoma 14.4.1

Steps to reproduce

  1. Run :Neogit
  2. : lua vim.o.foldenable = false to get expected UI with filenames

Expected behavior

filenames should show with just the diff folded

Actual behavior

no filenames showing only shows + -- x line folded

Minimal config

Neogit config used with Lazy nvim Plugin manager 


return {
    "NeogitOrg/neogit",
    dependencies = {
        "nvim-lua/plenary.nvim",  -- required
        "sindrets/diffview.nvim", -- optional - Diff integration

        -- Only one of these is needed, not both.
        "nvim-telescope/telescope.nvim", -- optional
    },
    config = function()
        local neogit = require('neogit')
        neogit.setup({
            sections = {
                sequencer = {
                    folded = false,
                    hidden = false,
                },
                bisect = {
                    folded = false,
                    hidden = false,
                },
                untracked = {
                    folded = false,
                    hidden = false,
                },
                unstaged = {
                    folded = false,
                    hidden = false,
                },
                staged = {
                    folded = false,
                    hidden = false,
                },
                stashes = {
                    folded = false,
                    hidden = false,
                },
                unpulled_upstream = {
                    folded = false,
                    hidden = false,
                },
                unmerged_upstream = {
                    folded = false,
                    hidden = false,
                },
                unpulled_pushRemote = {
                    folded = false,
                    hidden = false,
                },
                unmerged_pushRemote = {
                    folded = false,
                    hidden = false,
                },
                recent = {
                    folded = false,
                    hidden = false,
                },
                rebase = {
                    folded = false,
                    hidden = false,
                },
            },
        })

        vim.keymap.set('n', '<leader>gs', ':Neogit<CR>', { silent = true })
    end

}
@ashish10alex ashish10alex added the bug Something isn't working label May 16, 2024
@CKolkey
Copy link
Member

CKolkey commented May 17, 2024

What does :lua print(vim.wo.foldtext) show, when that buffer is open?

@ashish10alex
Copy link
Author

Hi, It does not print out anything

CleanShot.2024-05-17.at.17.49.14.mp4

@avegancafe
Copy link

I'm also hitting this issue, and have been on nightly for quite a while. Seems like something was just merged into master?

@CKolkey
Copy link
Member

CKolkey commented May 17, 2024

Odd - setting foldtext to an empty string will have neovim print the line.

With the minimal config (below) I get the following:

Screenshot 2024-05-17 at 23 06 12

This is with:

$ nvim -V1 -v
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202

Do you still see the same issue with the config here?
Minimal Init:

local M = {}

function M.root(path)
	local source = debug.getinfo(1, "S").source:sub(2)
	local base_path = vim.fn.fnamemodify(source, ":p:h") .. "/.min"

	return base_path .. "/" .. (path or "")
end

function M.load_plugin(plugin_name, plugin_url, branch)
	local package_root = M.root("plugins/")
	local install_destination = package_root .. plugin_name
	vim.opt.runtimepath:append(install_destination)

	if not vim.loop.fs_stat(package_root) then
		vim.fn.mkdir(package_root, "p")
	end

	if not vim.loop.fs_stat(install_destination) then
		print(string.format("> Downloading plugin '%s' to '%s'", plugin_name, install_destination))
		vim.fn.system({
			"git",
			"clone",
			"-b",
			branch or "master",
			"--depth=1",
			plugin_url,
			install_destination,
		})

		if vim.v.shell_error > 0 then
			error(
				string.format("> Failed to clone plugin: '%s' in '%s'!", plugin_name, install_destination),
				vim.log.levels.ERROR
			)
		end
	end
end

function M.setup(plugins)
	vim.opt.packpath = {}
	vim.opt.runtimepath:append(M.root(".min"))

	if plugins ~= nil then
		for plugin_name, plugin_url in pairs(plugins) do
			local branch
			if type(plugin_url) == "table" then
				plugin_url, branch = unpack(plugin_url)
			end

			M.load_plugin(plugin_name, plugin_url, branch)
		end
	end

	vim.env.XDG_CONFIG_HOME = M.root("xdg/config")
	vim.env.XDG_DATA_HOME = M.root("xdg/data")
	vim.env.XDG_STATE_HOME = M.root("xdg/state")
	vim.env.XDG_CACHE_HOME = M.root("xdg/cache")

	vim.api.nvim_create_autocmd("VimLeave", {
		callback = function()
			vim.fn.system({
				"rm",
				"-r",
				"-f",
				M.root("xdg"),
			})
		end,
	})
end

M.setup({
	plenary = "https://github.com/nvim-lua/plenary.nvim.git",
	telescope = "https://github.com/nvim-telescope/telescope.nvim",
	diffview = { "https://github.com/sindrets/diffview.nvim", "main" },
	neogit = { "/users/cameron/code/neogit", "nightly" },
})

vim.keymap.set("n", ";", ":")
vim.keymap.set("n", "<leader>gg", "<cmd>Neogit<cr>")

require("neogit").setup({})

@ashish10alex
Copy link
Author

Hi @CKolkey , I used your minimum config. Had to change the url of neogit as I believe its Is hardcoded to your personal path. I still have the same issue though

CleanShot 2024-05-17 at 23 26 38@2x

@ashish10alex
Copy link
Author

I uninstall neovim and re-installed the latest and greatest using which fixed the folding issue for me

brew unistall neovim
brew install neovim --HEAD

nvim version after the above commands

❯ nvim --version
NVIM v0.11.0-dev-3170+g0f4f7d32c-Homebrew
Build type: Release
LuaJIT 2.1.1713773202

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

No branches or pull requests

3 participants