navy-nvim-rs 0.0.21

A library for writing neovim rpc clients
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::{env, path::PathBuf};

const DEFAULT_NVIM_BIN: &str = if cfg!(windows) { "nvim.exe" } else { "nvim" };

pub fn nvim_path() -> PathBuf {
    match env::var("NVIMRS_TEST_BIN") {
        Ok(path_str) => {
            let path = PathBuf::from(&path_str);
            assert!(
                path.exists(),
                "nvim bin from $NVIMRS_TEST_BIN \"{}\" does not exist",
                path_str
            );
            path
        }
        Err(_) => PathBuf::from(DEFAULT_NVIM_BIN),
    }
}