nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.8k stars 220 forks source link

Getting "Press ENTER or type command to continue" when trying to exit nvim #983

Open erodactyl opened 1 year ago

erodactyl commented 1 year ago

When I add the option close_if_last_window = true in my config, and then try to exit nvim (using :q), I first get a message "Press ENTER or type command to continue", and only after I press a key nvim exits.

Can you please help me out avoid this strange behavior? Expected behavior: should just exit without having to press another button first.

Here is my minimal config with lazy vim as the package manager.

vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not 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",
    version = "*",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-tree/nvim-web-devicons",
      "MunifTanjim/nui.nvim",
    },
    config = function ()
      require('neo-tree').setup {
        close_if_last_window = true
      }
    end,
  } 
})
RocketDuD commented 1 year ago

I'm not sure if its a conflict, however I had a similar problem when passing a directory as argument to neovim. it seems to have been solved by disabling netrw by passing the following code before loading Neotree:

vim.g.loaded_netrw = 0 vim.g.loaded_netrwPlugin = 0

joshkoz commented 1 year ago

I also had the same issue. I found that I could prevent it by having neo-tree load on BufEnter so it was loaded in time to hijack netrw when starting neovim with a directory argument.