diff --git a/src/error.rs b/src/error.rs index de58f88..4fdb47f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -34,9 +34,7 @@ impl ErrorArea { {}\n\n\ Possible error reasons:\n\ ● Not supported nvim version (minimum supported version is {})\n\ - ● Error in configuration file (init.vim or ginit.vim)\n\ - ● Wrong nvim binary path \ - (right path can be passed with --nvim-bin-path=path_here)", + ● Error in configuration file (init.vim or ginit.vim)", encode_minimal(err), shell::MINIMUM_SUPPORTED_NVIM_VERSION)); self.base.show_all(); } diff --git a/src/nvim.rs b/src/nvim.rs index c209dd0..d9287bc 100644 --- a/src/nvim.rs +++ b/src/nvim.rs @@ -236,6 +236,8 @@ pub fn start( cmd.arg("--embed") .arg("--headless") + // Swap files are disabled because it shows message window on start up but frontend can't detect it. + .arg("-n") .arg("--cmd") .arg("set termguicolors") .arg("--cmd") @@ -388,15 +390,19 @@ fn call_gui_event( match try_str!(args[0]) { "Popupmenu" => { ui.nvim() - .unwrap() - .set_option(UiOption::ExtPopupmenu(try_uint!(args[1]) == 1)) - .map_err(|e| e.to_string())? + .ok_or_else(|| "Nvim not initialized".to_owned()) + .and_then(|mut nvim| { + nvim.set_option(UiOption::ExtPopupmenu(try_uint!(args[1]) == 1)) + .map_err(|e| e.to_string()) + })? } "Tabline" => { ui.nvim() - .unwrap() - .set_option(UiOption::ExtTabline(try_uint!(args[1]) == 1)) - .map_err(|e| e.to_string())? + .ok_or_else(|| "Nvim not initialized".to_owned()) + .and_then(|mut nvim| { + nvim.set_option(UiOption::ExtTabline(try_uint!(args[1]) == 1)) + .map_err(|e| e.to_string()) + })? } opt => error!("Unknown option {}", opt), }