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: Neotree not showing all buffers after restoring a session #1572

Open
3 tasks done
Oneechan69 opened this issue Sep 30, 2024 · 0 comments
Open
3 tasks done

BUG: Neotree not showing all buffers after restoring a session #1572

Oneechan69 opened this issue Sep 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Oneechan69
Copy link

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.10.1 Build type: Release LuaJIT 2.1.1725453128

Operating System / Version

macOS 15.1 Beta

Describe the Bug

When I open nvim and restore a session with either rmagatti/auto-session, or :mksession and :source, Neotree doesn't show all the open buffers while :ls does.

Screenshots, Traceback

No response

Steps to Reproduce

  1. nvim -u repro.lua
  2. Open 1-2 markdown files
  3. :mksession Session.vim
  4. reopen, nvim -u repro.lua
  5. Restore with :source Session.vim
  6. Do :ls for comparison

Expected Behavior

All buffers are shown after doing :Neotree buffers

Your Configuration

-- LazyNvim Setup
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
    {
        "nvim-neo-tree/neo-tree.nvim",
        branch = "v3.x",
        lazy = false,
        dependencies = {
          "nvim-lua/plenary.nvim",
          "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
          "MunifTanjim/nui.nvim",
          -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
        },
        config = function()
          require("neo-tree").setup({
            follow_current_file = {
              enabled = true
            },
            buffers = {
              leave_dirs_open = true,
              follow_current_file = {
                  enabled = true,
                  leave_dirs_open = true,
              },
              bind_to_cwd = false,
          },
            sources = { "filesystem", "buffers", "git_status", "document_symbols" },
            open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
            filesystem = {
              follow_current_file = { enabled = true },
              use_libuv_file_watcher = true,
            },
            window = {
              mappings = {
                ["<space>"] = "none",
                ["Y"] = {
                  function(state)
                    local node = state.tree:get_node()
                    local path = node:get_id()
                    vim.fn.setreg("+", path, "c")
                  end,
                  desc = "Copy Path to Clipboard",
                },
                ["O"] = {
                  function(state)
                    require("lazy.util").open(state.tree:get_node().path, { system = true })
                  end,
                  desc = "Open with System Application",
                },
              },
            },
            default_component_configs = {
              indent = {
                with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
                expander_collapsed = "",
                expander_expanded = "",
                expander_highlight = "NeoTreeExpander",
              },
              git_status = {
                symbols = {
                  unstaged = "󰄱",
                  staged = "󰱒",
                },
              },
            },
          })
        end,
      },
})


vim.api.nvim_create_autocmd("BufRead", {
    pattern = "*.md",
    callback = function()
      vim.cmd(":Neotree buffers")
      vim.cmd(":wincmd p")
    end,
})
@Oneechan69 Oneechan69 added the bug Something isn't working label Sep 30, 2024
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

1 participant