Skip to content

Long Term Task

Linwei edited this page Mar 9, 2020 · 14 revisions

When there are tasks running for hours, here are some tips for you.

Enable Notification

[.test-help]
...
notify=echo

And you will receive a notification in your command line when the job finished:

Silent Quickfix

You can prevent quickfix open by:

[xxx]
...
silent=1

If there is a silent=1 in your task, quickfix window will not open automatically no matter g:asyncrun_open is set or not.

New Terminal Tab

Running your task in a new terminal tab can prevent interfering your current window layout:

Enable tab based terminal globally

let g:asynctasks_term_pos = 'tab'

Or enable tab terminal only for special task in the task options:

[xxx]
...
output=terminal
pos=tab

Prevent Focus Changing

When focus=0 provided in the task option, you can keep your current window/tab actived without switching to the internal terminal:

[xxx]
...
output=terminal
pos=tab
focus=0

After :AsyncTask xxx, a new terminal tab is created but not actived, you are still in your previous tab:

Hide the Terminal Completely

[xxx]
...
output=terminal
pos=hide
notify=hide

The terminal will be hidden completely, you can check the notification in command line if task finished.

Recommendation

The final version for long term tasks:

[task1]
...
output=terminal
pos=tab
focus=0
notify=echo
Clone this wiki locally