removing neotree to start open on file open
This commit is contained in:
@@ -19,25 +19,6 @@ return {
|
|||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require('neo-tree').setup(opts)
|
require('neo-tree').setup(opts)
|
||||||
vim.keymap.set('n', '<C-n>', '<CMD>Neotree toggle<CR>', {})
|
vim.keymap.set('n', '<C-n>', '<CMD>Neotree toggle<CR>', {})
|
||||||
-- Option 2: More targeted - only when opening actual files
|
|
||||||
vim.api.nvim_create_autocmd({"BufReadPost", "BufNewFile"}, {
|
|
||||||
callback = function()
|
|
||||||
-- Check if it's a real file (has a name and isn't a special buffer)
|
|
||||||
local bufname = vim.api.nvim_buf_get_name(0)
|
|
||||||
if bufname == "" or vim.bo.buftype ~= "" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Skip if neo-tree is already visible
|
|
||||||
local manager = require("neo-tree.sources.manager")
|
|
||||||
local state = manager.get_state("filesystem")
|
|
||||||
if state.tree and state.tree.visible then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require("neo-tree.command").execute({ action = "show", source = "filesystem" })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user