Add jobstart example

pull/3/head
Timothée Sterle 4 years ago
parent 82165651a1
commit 24e4123c68
No known key found for this signature in database
GPG Key ID: 136D558122196ED5

@ -635,6 +635,12 @@ print(vim.call('printf', 'Hello from %s', 'Lua'))
local reversed_list = vim.call('reverse', { 'a', 'b', 'c' })
print(vim.inspect(reversed_list)) -- { "c", "b", "a" }
local function print_stdout(chan_id, data, name)
print(data[1])
end
vim.call('jobstart', 'ls', { on_stdout = print_stdout })
vim.call('my#autoload#function')
```
@ -650,6 +656,12 @@ print(vim.fn.printf('Hello from %s', 'Lua'))
local reversed_list = vim.fn.reverse({ 'a', 'b', 'c' })
print(vim.inspect(reversed_list)) -- { "c", "b", "a" }
local function print_stdout(chan_id, data, name)
print(data[1])
end
vim.fn.jobstart('ls', { on_stdout = print_stdout })
```
Hashes `#` aren't valid characters for indentifiers in Lua, so autoload functions have to be called with this syntax:

Loading…
Cancel
Save