Comments (4)
Thanks for sharing, but there are two problems with this setup:
- It requires that netrw be enabled, while the current setup does not. I know that I disable unused plugins like that.
- Since you have to wait for the netrw window to load first, that adds a delay every time it is used and likely a visual flash that some people will notice.
Given the above, it really doesn't seem to be an improvement at all.
If your goal is a faster startup time, does netrw actually initialize faster than neo-tree? If so, I would rather optimize neo-tree's internally lazy loading so that it does need to be lazy loaded by the plugin manager. Then again, if your goal is to be able to netrw hijack at startup, then neo-tree shouldn't be lazy loaded at all, should it?
I don't think the use case of still using netrw and neo-tree at the same time is a reasonable default. If I wanted to access remote files, I would much rather use netman.nvim than netrw.
from neo-tree.nvim.
it adds a delay the first time you use neo-tree (when the plugin is initially lazy-loaded) and the delay in question is just loading neo-tree instead of everything at once, which took 100ms on a raspberry pi, you also don't wait for netrw to load before loading neo-tree, you only wait on the replacing part (the filetype is set quite early)
also the non-lazy implementation also adds a delay, both on opening a file buffer and on initial load, both of which can be seen as a flash
folder current: total 155ms/287ms, neotree 65ms
file current: total 184ms/367ms, neotree 66ms
folder lazy: total 93ms/286ms, neotree+netrw 87ms
file lazy: total 88ms/280ms, (later than start ->) neotree+netrw 50ms
the total times don't change much for folders, but they're distributed across different moments for files, which makes them feel faster
also i only want to hijack netrw at startup when i'm opening a folder, if i'm opening a file i don't want either to load - which the lazy solution accomplishes
netrw only loads when opening a folder, so it takes 0ms when editing files, while neo-tree hijacking still has to load the plugin even if it's not immediately used
edit: also, netman.nvim crashes for me, i don't know why
from neo-tree.nvim.
version 2:
the following results in no netrw overhead and full lazy-loading:
{
'nvim-neo-tree/neo-tree.nvim',
cmd = 'Neotree',
init = function()
vim.api.nvim_create_autocmd('BufEnter', {
-- make a group to be able to delete it later
group = vim.api.nvim_create_autogroup('NeoTreeInit', {clear = true}),
callback = function()
local f = vim.fn.expand('%:p')
if vim.fn.isdirectory(f) ~= 0 then
vim.cmd('Neotree current dir=' .. f)
-- neo-tree is loaded now, delete the init autocmd
vim.api.nvim_clear_autocmds{group = 'NeoTreeInit'}
end
end
})
-- keymaps
end,
opts = {
filesystem = {
hijack_netrw_behavior = 'open_current'
}
}
}
folder lazy: total 123ms/194ms, neotree 64ms
file lazy: total 94ms/245ms, (later ->) neotree 90ms
this version loads neo-tree before netrw, and so does not load netrw for local files due to hijacking, by adding:
vim.g.loaded_netrwPlugin = 1
vim.g.loaded_netrw = 1
you can also disable netrw for remote file viewing and the above still works
from neo-tree.nvim.
For what it's worth, when using the suggested netrw hijacking behavior, I already see the visual flash you describe @cseickel, which is what led me to this issue.
@Aonodensetsu Thanks a bunch for your latest suggestion, as I'm finally getting smooth hijacking behavior (AND it's lazily loaded so my startup time has sped up by 25%... i.e. 10ms... every bit counts lol)
from neo-tree.nvim.
Related Issues (20)
- BUG: Neotree reveal puts the selected node on top of the view HOT 4
- FEATURE: Allow changing the `git_root` using `dir` for `git_status`
- BUG: jump to selected item when opening folder HOT 17
- BUG: Neotree can't get icon for Diagnostic HOT 2
- BUG: Document Symbol source break in some special LS. HOT 3
- FEATURE: Focus newly created file HOT 5
- FEATURE: Option for `follow_current_file` to follow into hidden files HOT 4
- BUG: file names are truncated when relative line numbers are enabled HOT 4
- BUG: Error message when adding, deleting, or renaming files or folders HOT 1
- BUG: Re-opening any file lefts `untitled` buffer opened HOT 5
- Help: how can i remove the "padding" colors round the boder? HOT 1
- BUG: renderer.lua:431: '=' expected near 'continue' HOT 3
- FEATURE: Know if the neo-tree window is opened HOT 2
- FEATURE: Short path names for folders HOT 1
- BUG: performance issue when expanded directories are being regenerated HOT 5
- BUG: ignored directories are changing colors
- FEATURE: add mapping to copy absolute path of the file HOT 8
- FEATURE: When help window is open, do not completely close neotree when `q` is pressed HOT 2
- BUG: `close_if_last_window` invalid command to swap to modified buffer HOT 2
- BUG: directories beginning or ending with symbol cause error in filesystem command `set_root` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neo-tree.nvim.