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

Ask the asynchronous features for Vim 8.1/8.2 #1170

Closed
jiangjianshan opened this issue Aug 22, 2020 · 5 comments
Closed

Ask the asynchronous features for Vim 8.1/8.2 #1170

jiangjianshan opened this issue Aug 22, 2020 · 5 comments

Comments

@jiangjianshan
Copy link

jiangjianshan commented Aug 22, 2020

Hello,

NERDTree is very good plugin for Vim but it seems doesn't support asynchronous features for vim 8.1/8.2. Because if we open a folder which has a huge of files inside, it will be spend many time to load it and Vim has to wait for it. The other plugin defx.nvim has been used the Remote plugin from NeoVim. It should be good idea for NERDTree can implement the asynchronous features for Vim 8.1/8.2.

@noscript
Copy link

Asynchronous vim features are only applicable when communicating with external processes.

NERDTree is implemented in pure VimScript, so async support would require to rewrite at least some parts of the plugin in another language.

@jiangjianshan
Copy link
Author

@noscript , thanks for you reply. I'm not familar with Vim script but can read to understand them. Python is one of my familar language. Does the member has the road map to do this asynchronous feature? NERDTree is really a excellent vim plugin but only may missing the asynchronous feature.

@raven42
Copy link

raven42 commented Sep 25, 2020

would it be possible to use timer_start() along with a lambda callback to run in the background? Something like this maybe....

function! s:NERDTree.__update(name)
    ... process a:name to generate tree hierarchy
endfunction

function! s:NERDTree.update(name)
    if has('lambda') && has('timers')
        call timer_start(0, { -> s:NERDTree.__update(a:name)})
    else
        call s:NERDTree.__update(a:name)
    endif
endfunction

@noscript
Copy link

Vim is single threaded and so timers are executed in the same thread. Any long operation will freeze Vim.

@PhilRunninger
Copy link
Member

Given that vim (and even neovim) is single-threaded, there is no sense in attempting this. Plus, I have no plans to rewrite NERDTree in another language. The reason NERDTree is so slow (and a memory hog) is that it creates an object in memory for each item on the tree. This is a very slow and memory intensive process when the tree is large, and is a lot of overhead because many of those objects are just taking up space when the files they represent aren't accessed.

There are plenty of other plugins out that either do less in terms of memory with the files, or are written at least partially as external programs. They operate better than anything I'd have the time or patience to rewrite NERDTree into.

And there are people who want Vimscript-only plugins (I was one once.), and I think NERDTree fits that bill well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants