|
|
@ -22,25 +22,26 @@ use crate::window::window_geometry_or_default;
|
|
|
|
pub use events::*;
|
|
|
|
pub use events::*;
|
|
|
|
use handler::NeovimHandler;
|
|
|
|
use handler::NeovimHandler;
|
|
|
|
pub use layouts::*;
|
|
|
|
pub use layouts::*;
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
|
|
|
use std::path::Path;
|
|
|
|
pub use ui_commands::UiCommand;
|
|
|
|
pub use ui_commands::UiCommand;
|
|
|
|
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref BRIDGE: Bridge = Bridge::new();
|
|
|
|
pub static ref BRIDGE: Bridge = Bridge::new();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
#[cfg(windows)]
|
|
|
|
fn set_windows_creation_flags(cmd: &mut Command) {
|
|
|
|
fn set_windows_creation_flags(cmd: &mut Command) {
|
|
|
|
cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
|
|
|
|
cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
#[cfg(windows)]
|
|
|
|
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
if !Path::new(&bin).exists() {
|
|
|
|
if !Path::new(&bin).exists() {
|
|
|
|
return None;
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if std::env::args()
|
|
|
|
if env::args()
|
|
|
|
.collect::<Vec<String>>()
|
|
|
|
.collect::<Vec<String>>()
|
|
|
|
.contains(&String::from("--wsl"))
|
|
|
|
.contains(&String::from("--wsl"))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -52,9 +53,8 @@ fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(target_os = "windows"))]
|
|
|
|
#[cfg(unix)]
|
|
|
|
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
if Path::new(&bin).exists() {
|
|
|
|
if Path::new(&bin).exists() {
|
|
|
|
Some(Command::new(bin))
|
|
|
|
Some(Command::new(bin))
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -63,26 +63,20 @@ fn platform_build_nvim_cmd(bin: &str) -> Option<Command> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn build_nvim_cmd() -> Command {
|
|
|
|
fn build_nvim_cmd() -> Command {
|
|
|
|
if let Some(path) = std::env::var_os("NEOVIM_BIN") {
|
|
|
|
if let Ok(path) = env::var("NEOVIM_BIN") {
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(&path.to_string_lossy()) {
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(&path) {
|
|
|
|
return cmd;
|
|
|
|
return cmd;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
warn!("NEOVIM_BIN is invalid falling back to first bin in PATH");
|
|
|
|
warn!("NEOVIM_BIN is invalid falling back to first bin in PATH");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Ok(path) = which::which("nvim") {
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(path.to_str().unwrap()) {
|
|
|
|
{
|
|
|
|
cmd
|
|
|
|
if let Ok(path) = which::which("nvim") {
|
|
|
|
} else {
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(path.to_str().unwrap()) {
|
|
|
|
error!("nvim does not have proper permissions!");
|
|
|
|
return cmd;
|
|
|
|
std::process::exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let default_path = "/usr/local/bin/nvim";
|
|
|
|
|
|
|
|
if let Some(cmd) = platform_build_nvim_cmd(default_path) {
|
|
|
|
|
|
|
|
cmd
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
error!("nvim not found!");
|
|
|
|
error!("nvim not found!");
|
|
|
|
std::process::exit(1);
|
|
|
|
std::process::exit(1);
|
|
|
@ -96,7 +90,7 @@ pub fn create_nvim_command() -> Command {
|
|
|
|
.args(SETTINGS.neovim_arguments.iter().skip(1))
|
|
|
|
.args(SETTINGS.neovim_arguments.iter().skip(1))
|
|
|
|
.stderr(Stdio::inherit());
|
|
|
|
.stderr(Stdio::inherit());
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
#[cfg(windows)]
|
|
|
|
set_windows_creation_flags(&mut cmd);
|
|
|
|
set_windows_creation_flags(&mut cmd);
|
|
|
|
|
|
|
|
|
|
|
|
cmd
|
|
|
|
cmd
|
|
|
|