From dc1bf55a46927329e0b30db363c9dc7d0b9d058f Mon Sep 17 00:00:00 2001 From: daa Date: Sat, 19 Mar 2016 14:32:59 +0300 Subject: [PATCH] Fix embed mode --- Cargo.lock | 3 +-- src/nvim.rs | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 385cee3..d5c44c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ dependencies = [ "cairo-rs 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "neovim-lib 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "neovim-lib 0.1.0", "rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -195,7 +195,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "neovim-lib" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rmp-serialize 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/nvim.rs b/src/nvim.rs index ea3382d..016b4ed 100644 --- a/src/nvim.rs +++ b/src/nvim.rs @@ -1,4 +1,4 @@ -use neovim_lib::{Neovim, Session}; +use neovim_lib::{Neovim, NeovimApi, Session}; use std::io::{Result, Error, ErrorKind}; use rmp::Value; @@ -8,12 +8,14 @@ pub struct Nvim { impl Nvim { pub fn start() -> Result { - let mut session = try!(Session::new_tcp("127.0.0.1:6666")); - //let mut session = try!(Session::new_child()); + //let mut session = try!(Session::new_tcp("127.0.0.1:6666")); + let mut session = try!(Session::new_child()); session.start_event_loop_cb(Nvim::cb); let mut nvim = Neovim::new(session); + // fix neovim --embed bug to start embed mode + nvim.input("i").unwrap(); try!(nvim.ui_attach(80, 24, true).map_err(|e| Error::new(ErrorKind::Other, e))); Ok(Nvim {