-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README, example, add a kill function, make exttypes be encoded
- Loading branch information
Showing
5 changed files
with
56 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import 'package:dart_nvim_api/dart_nvim_api.dart'; | ||
|
||
main(List<String> args) async { | ||
// Start up Neovim instance and communicate over stdin/stdout: | ||
var nvim = Neovim(nvimBinaryPath: 'nvim'); | ||
|
||
// Or connect to already running instance over TCP: | ||
// var nvim = Neovim.connectToRunningInstance(host: '127.0.0.1', port: 8888); | ||
void main(List<String> args) async { | ||
// Start up Neovim instance, with optional `onNotify` and `onRequest` | ||
// callbacks. | ||
// See also Nvim.child() | ||
var nvim = await Nvim.spawn(); | ||
|
||
// Run Neovim ex command. | ||
await nvim.command("echo 'hello'"); | ||
|
||
// Get ex command output. | ||
assert(await nvim.commandOutput("echo 'hello'") == null); | ||
|
||
assert(await nvim.exec('echo 1 + 1', true) == '2'); | ||
|
||
// Buffer example: | ||
var buf = await nvim.createBuf(true, false); | ||
var bufNum = await buf.getNumber(nvim); | ||
assert(bufNum == 2); | ||
assert(await nvim.getCurrentBuf() is Buffer); | ||
var bufNameWithoutPath = 'some name'; | ||
await nvim.bufSetName(buf, bufNameWithoutPath); | ||
var bufName = await nvim.bufGetName(buf); | ||
assert(bufName.contains(bufNameWithoutPath)); | ||
|
||
// Beyond that, you can run any Neovim api command. See `:help api-rpc` doc in Neovim. | ||
// Kill Neovim when done. | ||
nvim.kill(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters