extern crate neovim; use neovim::{AttachOptions, Message, Neovim, Value}; use std::time::Duration; use tokio::time; #[tokio::main] async fn main() { let mut neovim = Neovim::from_child("/opt/homebrew/bin/nvim").unwrap(); let h = tokio::spawn({ let mut rx = neovim.spawn(); async move { while let Some(message) = rx.recv().await { match message { Message::Notification { method, params } => match method.as_str() { "redraw" => { let a = neovim::events::Redraw::parse(params); dbg!(a); } _ => continue, }, _ => {} }; } } }); let a = neovim .attach(80, 40, AttachOptions::default().build()) .await; dbg!(a); let h2 = tokio::spawn(async move { let mut interval = time::interval(Duration::from_millis(1000)); loop { interval.tick().await; let _ = neovim.request("nvim_input", vec![Value::from("i")]).await; } }); tokio::join!(h, h2).0.unwrap(); }