Async vim script?

I use vim to perform slow operations after saving the file, these operations allow my vim to get stuck, so I wonder if there is some kind of asynchronization method to make these operations run in the background?

Demo:

autocmd BufWritePost *.js call DoSomeTing() function! DoSomeThing() " some operations really slow endfunction 
+7
source share
1 answer

You can use one of the more powerful language bindings (like Python) to start a new thread and do your work there. However, it is usually a very difficult task to qualify. Also, you should not try to modify any vim structures or call any vim functions from these other threads - nothing in the vim kernel is thread safe.

+5
source

All Articles