We changed our privacy policy. Read more.

Hot answers tagged

7

From discussion in comments I learned that OP has a custom vimgrep call and would like to run it asynchronously. The utility of this is pretty clear, especially if you run a lot of searches that take a while: by moving the execution into a separate/background thread you free up Vim's UI so you can continue working without waiting for the result. As I ...


3

I guess mouse clicks don't update the jump list. (:help jump-motions seems to confirm this is the case.) Try this, for the async solution: augroup MouseHack autocmd! autocmd FocusLost * set mouse= autocmd FocusGained * call timer_start(200, 'ReenableMouse') augroup END function ReenableMouse(timer_id) set mouse=a endfunction Note that this ...


3

Update: neovim now (January 2020) supports perl as well as has('perl'). I update neovim very often to the latest development version, and I only noticed the feature today when running checkhealth. If you are using a stable version of neovim, you probably will not see support for perl yet.


3

Neovim is always compiled with all the features, so rebuilding won't help you: Perl support simply isn't included in the version of Neovim you are running. See (:help feature-compile, :help nvim-features-missing). However, later versions of Neovim do include Perl support, so upgrading will add this feature for you. As for your other question about Python, ...


3

If you want to perform asynchronous tasks from Vim, people generally recommend using the vim-dispatch plugin to run external processes in the background and call back later. But since I don't have an example for that, I'm going to offer some dirty synchronous tricks instead... You could consider only doing the work when the user has gone idle, by waiting ...


3

vim-dispatch :Make instead of :make You cannot run the built-in command :make asynchronously in Vim8 or NeoVim. You have to take the value of 'makeprg' and insert it into vim8 job_start() or neovim jobstart(). I personally like the convenience of plugins which take care of vim8/neovim differences, parsing the result and inserting it into the quickfix/...


2

Tested on Vim Version: 8.2.1537 Response: A timer's resources will be freed on one of three conditions: the timer_stop() function in Vim is called, invoking it's counterpart stop_timer() in the C source.1 after invoking the callback function, there are no repetitions left for the timer, upon which free_timer() is invoked.2 the timer has encountered an ...


2

This question is largely addressing some follow-up questions OP had in response to an answer I gave to another question that they posted. This one also talks about a solution involving lambda functions and closures that is valid but more complicated than needed for most use cases. For both those reasons I recommend you check out that Q&A first: How to ...


1

Although this question raises some as yet unanswered questions about how to best handle doing long-running stuff in the traditional :python style plugin, it seems mostly moot now that I've spent some time understanding the new style remote plugin system. nvim-example-python-plugin was helpful (though slightly outdated), so I'd recommend anyone else finding ...


1

Is it possible to call a vim script function with the help of job_start? Not directly. I guess you would need Vim to be multithreaded, which might be possible in the future. In fact I've used the command :vimgrep to make my custom grep. It worked. Now I starts to use vim 8 so I'm thinking if it's possible to make my custom grep async. FWIW, I wrote some ...


1

There are currently two great plugins I found that can run commands asynchronously: vim-dispatch and asyncrun.vim. The two plugins have async support for both Neovim and Vim, but you have to make sure you have relatively new versions of Neovim or Vim (see their home for exact version requirements.)


1

Vim: let job = job_start(...) let channel = job_getchannel(job) call ch_sendraw(channel, data) call ch_close_in(channel) NeoVim: let jobid = jobstart(...) call chansend(jobid, data) call chanclose(jobid, 'stdin')


1

That patch job, defines a new VimL function jobrun(). But you better ask at that repository for a documentation.


Only top voted, non community-wiki answers of a minimum length are eligible