aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2015-01-14 01:35:40 -0500
committerMichael Reed <m.reed@mykolab.com>2015-03-24 19:29:29 -0400
commitab68ac4c0221a3cfef13d86d0ebf9fc7bad710f7 (patch)
treece0efcf75316b413a02cb7938458628d1b8cf80a
parentc60dd09408901c14bdc245ad1a7d949142cb7546 (diff)
downloadrneovim-ab68ac4c0221a3cfef13d86d0ebf9fc7bad710f7.tar.gz
rneovim-ab68ac4c0221a3cfef13d86d0ebf9fc7bad710f7.tar.bz2
rneovim-ab68ac4c0221a3cfef13d86d0ebf9fc7bad710f7.zip
doc: Add one-liner job control example
-rw-r--r--runtime/doc/job_control.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt
index 000409597f..b3a95ae7b9 100644
--- a/runtime/doc/job_control.txt
+++ b/runtime/doc/job_control.txt
@@ -37,6 +37,17 @@ for details
==============================================================================
2. Usage *job-control-usage*
+Here's a quick one-liner that creates a job which invokes the "ls" shell
+command and prints the result:
+>
+ call jobstart('', 'ls', ['-a'])|au JobActivity * echo v:job_data|au!
+ JobActivity
+
+In the one-liner above, creating the JobActivity event handler immediately
+after the call to jobstart() is not a race because the Nvim job system will
+not publish the job result (even though it may receive it) until evaluation of
+the chained user commands (`expr1|expr2|...|exprN`) has completed.
+
Job control is achieved by calling a combination of the |jobstart()|,
|jobsend()| and |jobstop()| functions, and by listening to the |JobActivity|
event. The best way to understand is with a complete example: