13
votes
Accepted
How to start an async function in Vim 8?
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 ...
9
votes
Accepted
job_start() command only works with seemingly random job options
I think I figured this out myself. I believe the problem was that my job was being deleted before the zip command finished. I guess Vim deletes a job object if there are no references to it. So the ...
6
votes
Accepted
Job continuously outputting to Vim buffer
This is almost surely happening because the output from cmd is getting buffered when being sent to a pipe, so until you get enough of it (a few kilobytes), Vim won't really receive any.
A very simple ...
5
votes
Accepted
How do I get the output of a vim 8.0 job?
Vim jobs start with a channel, you can use job-options to redirect output to a buffer. For example:
:let job = job_start('ls -alh', {'out_io': 'buffer', 'out_name': 'mybuffer'})
then
:sbuf ...
5
votes
Accepted
Run :cwindow after :Neomake finishes
Neomake runs a user autocmd called NeomakeFinished when it's done. It sets the context variable: g:neomake_hook_context.file_mode. If it's 1 it's using the location list.
If you only want it to run ...
4
votes
Run :cwindow after :Neomake finishes
I don't know first hand if it works with your fork but the following snippets works perfectly in real Vim:
augroup qf
autocmd!
" automatically open the location/quickfix window after :make, :...
3
votes
Accepted
How do you send vim to the background from a terminal window?
You can use Ctrl+W, : to enter Ex mode from the terminal, then use the :suspend command to suspend Vim (same as Ctrl+Z typically does.)
When you come back to Vim using fg, you'll be on your Vim ...
2
votes
How can I set the working directory for only the job_start() process?
In Build-Tool-Wrapper, I've used sh -c to actually run cd compdir && make args:
" the a:cmd is managed elsewhere in the plugin
" it may contain many things, usually things like
" `cd ...
2
votes
Vim immediately sent to background
I shouldn't have set the shell as interactive. Somehow it pauses the main Vim process.
So:
set shell=bash\ -i
Should be:
set shell=bash
2
votes
Accepted
How to pass a parameter to a function called from an on_exit event of an asynchronous task
Have you tried partials?
{'on_exit': function('OnEvent', [parameters])}
This is what I do in lh-tags+lh-vim-lib to register things like: delete a temporary file and print a finished message on ...
2
votes
Accepted
How to use JSON API to send messages from terminal to vim?
Section :help terminal-api includes a thorough description of the API and also an example function:
function Tapi_Impression(bufnum, arglist)
if len(a:arglist) == 2
echomsg "impression &...
2
votes
Accepted
What is the proper way to use the async mechanism: timer_start
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 ...
2
votes
Accepted
Vim Script: How to pass Varargs to a lambda in timer_start
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 ...
2
votes
How to start an async function in Vim 8?
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 ...
2
votes
Neovim Jobstart(), not receiving STDOUT sometimes (if async I think)
Turned out rg command for some reason behaves a certain way when called from the following:
Window cmd
bash
vim :!
Ubuntu jobstart()
Differently to when called from
Windows jobstart()
The solution ...
1
vote
Why does ch_evalraw() evaluate to my message instead of the response?
The reason why you're seeing the command you just ran coming back in the channel is because Windows' cmd.exe will by default run with “echo” on, which means it will print back the command to be ...
1
vote
Accepted
keep contents of nofile buffer
You also need setl bufhidden=hide to prevent the buffer from getting unloaded when you switch to another buffer.
See also :help special-buffers, in particular the entry for "scratch" buffers....
1
vote
prevent line wrap in terminal buffer
I came up with a solution using channels, an idea based on Bram's presentation in this video.
command! -complete=shellcmd -nargs=+ Shell call s:TmpShellOutput(<q-args>)
function! s:...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
job-control × 27neovim × 7
terminal-buffer × 4
vim8 × 3
async × 3
vimscript × 2
terminal × 2
vimrc × 1
key-bindings × 1
functions × 1
external-command × 1
quickfix × 1
bash × 1
wrapping × 1
shell × 1
filetype-c++ × 1
startup × 1
working-directory × 1
plugin-neomake × 1
background × 1
system × 1