goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.84k stars 109 forks source link

When nvimTree opens the file, alpha is not closed #114

Closed zlongCoding closed 1 year ago

zlongCoding commented 2 years ago

When I opened the file via nvimTree, alpha was not closed 7-0032

konart commented 2 years ago

Same here, but only for a certain filetypes. This happens when opening lua files but golang files do replace alpha.

Happens for me too but I'm guessing this is a nvim-tree issue. Happens only if not in a git inited folder

goolord commented 2 years ago

this doesn't happen for me but i suspect maybe it's because i have https://github.com/goolord/nvim/blob/main/lua/plugins/nvim-tree.lua#L46 update_focused_file = { enable = true },

goolord commented 2 years ago

anyway, this is either an issue with nvimTree or with your specific configuration, i've done about all i can on alpha's side to integrate it with other plugins ¯\_(ツ)_/¯

it's already

vim.opt_local.bufhidden = 'wipe'
vim.opt_local.buflisted = false
vim.opt_local.buftype = 'nofile'
namishh commented 2 years ago

same happening for me too, any fix? tho it only happens when i open file from NvimTree, telescope works fine edit i just copied @goolord 's NvimTree config and now it works fine

goolord commented 2 years ago

yeah so from what i gather the window picker for nvim-tree ignores buftype = nofile buffers, which will keep the alpha buffer open in a split, unless update_focused_file is set for some reason.

i can think of some workarounds for this but they're not really very pretty..

hermitmaster commented 2 years ago

I have a fairly basic nvim-tree config and I don't have this issue.

use {
    'kyazdani42/nvim-tree.lua',
    requires = 'kyazdani42/nvim-web-devicons',
    ft = 'alpha',
    config = function()
      local tree_cb = require('nvim-tree.config').nvim_tree_callback

      require('nvim-tree').setup {
        disable_netrw = true,
        ignore_buffer_on_setup = true,
        open_on_setup = true,
        view = {
          mappings = {
            custom_only = true,
            list = {
              { key = '<cr>', cb = tree_cb('edit') },
              { key = '<C-v>', cb = tree_cb('vsplit') },
              { key = '<C-x>', cb = tree_cb('split') },
              { key = 'h', cb = tree_cb('toggle_dotfiles') },
              { key = 'i', cb = tree_cb('toggle_git_ignored') },
              { key = 'R', cb = tree_cb('refresh') },
              { key = 'a', cb = tree_cb('create') },
              { key = 'd', cb = tree_cb('trash') },
              { key = 'q', cb = tree_cb('close') },
              { key = 'r', cb = tree_cb('rename') },
              { key = 's', cb = tree_cb('system_open') },
              { key = 'x', cb = tree_cb('cut') },
              { key = 'c', cb = tree_cb('copy') },
              { key = 'p', cb = tree_cb('paste') },
              { key = 'y', cb = tree_cb('copy_path') },
              { key = 'Y', cb = tree_cb('copy_absolute_path') },
              { key = 'K', cb = tree_cb('toggle_help') },
            },
          },
        },
      }
    end,
  }

I use ft=alpha to launch nvim-tree at startup after alpha.

mosheavni commented 1 year ago

Also experiencing this. Any ideas?