Questions tagged [async]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
503 views

How to use "FocusGained" to stop my cursor from moving

I tend to use GVim a lot. Very frequently, I'll click on some other window and then when I click on vim to regain focus, my cursor will end up in some random location depending on where I clicked. I ...
13 votes
2 answers
9k views

Running a command Async in Neovim

As far as I know, Neovim enables running a command async, without blocking the user. I was told this is also enabled in Vim 8. But I couldn't find examples of how to run a command asynchronously. ...
7 votes
2 answers
4k views

How to start an async function in Vim 8?

I've known that Vim 8 provides us an async mechanism job_start so that we can start a command asynchronously and get its return with the help of channel. However, it seems that job_start can only ...
3 votes
1 answer
881 views

How to async run vimscript system calls

I have a vimscript function which uses a combination of vimscript functions and also some calls to :call system(). The vimscript and the system() calls can be 5-10 seconds slow, during which time, Vim ...
2 votes
0 answers
133 views

Neovim rplugin: why does vim.async_call(print, "msg") not echo?

In a traditional :python3 plugin, I can call print("msg") to echo a message. In a remote plugin function, I expect that calling vim.async_call(print, "msg") would do the same thing,...
1 vote
1 answer
399 views

Neovim: How to start developing python plugins which run long-blocking code?

EDIT2: A user suggested that I may be going about this in a fundamentally wrong way, in particular in that I am not using remote (new-style) plugins and am trying to use async python code where it ...
1 vote
1 answer
1k views

Simple Asynchronous function call in Neovim (defer_fn or timer_start ?)

I'm trying to create a very simple shortcut that saves the buffer and cleans the writing message after a second. nmap <silent> <leader>w :w<CR>:sleep 1<CR>:echo ""<...
2 votes
1 answer
619 views

Vim Script: How to pass Varargs to a lambda in timer_start

I'm configuring my vim with Vim Script. I have set my own custom grep function as below: function! CustomGrepCore(...) if a:0 == 0 " do something else if a:0 == 1 " ...
2 votes
1 answer
947 views

What is the proper way to use the async mechanism: timer_start

I just started to use Vim 8 and I'm trying to figure out how to use the async mechanism: timer_start. As my understanding, timer_start allows us to run a job asynchronously and repeatly. I have two ...
4 votes
2 answers
953 views

How to build nvim to has_perl?

I am on macOS. My ultimate goal is to speed up dbext.vim and I found the page mentioned DBI which depends on has('perl'). So I'd like to know how to build Neovim to have Perl enabled... Now I am ...
2 votes
1 answer
667 views

How to pass a string as stdin to a job?

I have a shell command which reads from stdin, processes the input, and writes to stdout. To call it synchronously from vim I can do system('mycommand', data) where data is some string my vimscript ...
3 votes
1 answer
753 views

Can't echo messages from inside async functions

CASE 1: Have your autocmd command be setup like this: autocmd User ALELintPost call SayHello() " ALELintPost is async And your SayHello function set up like this function! SayHello() abort ...
3 votes
1 answer
2k views

How to get git branch information supplied by vim-fugitive asynchronously for my statusline?

I can directly use the following approach to get the git branch information: ... let l:git = "%6*%{exists('g:loaded_fugitive')?fugitive#statusline():''}%*" ... If so, it can cause a delay to the ...
0 votes
2 answers
171 views

How to execute global/substitution command asynchronously?

With the release of vim 8, I was wondering if there is a way to execute :s or :g asynchronously.
5 votes
0 answers
65 views

Is there an ideal / idiomatic way to debug running plugins?

I sometimes have plugs stop working — in my case, mostly using async lookups with Unite. When this happens, I would like to see what is happening and look into how to configure around it, or make a ...
1 vote
1 answer
62 views

async_job patch in Kaoryia's gVim (windows)

Kaoryia's gVim builds for Win32/64 come with a number of extra, non-official patches enabled. Some of them are pretty clear: :set charspace=-1, for example, will tighten the space between characters;...