[−][src]Crate kak_ui
Provides a high-level wrapper around kakoune's JSON-RPC UI. This crate doesn't have any opinions on how you choose to communicate with kakoune or how you choose to deserialize/serialize JSON as long as it is supported by serde.
The main types to look at here are IncomingRequest
and OutgoingRequest
.
Examples
Basic usage:
use std::io::{BufRead, BufReader}; use std::process::{Command, Child, Stdio}; use kak_ui::{IncomingRequest, OutgoingRequest}; let kak_child_process = Command::new("kak") .args(&["-ui", "json"]) .stdout(Stdio::piped()) .stdin(Stdio::piped()) .spawn() .unwrap(); let incoming_request: IncomingRequest = serde_json::from_str( &BufReader::new(kak_child_process.stdout.unwrap()) .lines() .next() .unwrap() .unwrap(), ) .unwrap(); let outgoing_request = OutgoingRequest::Keys(vec!["<esc>:q<ret>".to_string()]); serde_json::to_writer(kak_child_process.stdin.unwrap(), &outgoing_request).unwrap();
Structs
KakAtom | A kakoune atom |
KakColor | A color in kakoune. Currently, this is a newtype wrapper around String. |
KakCoord | A coordinate in kakoune |
KakFace | A kakoune face |
Enums
IncomingRequest | A incoming request. Recieve this from kakoune's stdout |
KakAttribute | An attribute in kakoune |
OutgoingRequest | A outgoing request. Input this to kakoune via stdin. |
Type Definitions
KakLine |