diff options
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/clipboard.rs | 4 | ||||
-rw-r--r-- | helix-view/src/document.rs | 7 | ||||
-rw-r--r-- | helix-view/src/editor.rs | 4 | ||||
-rw-r--r-- | helix-view/src/env.rs | 8 | ||||
-rw-r--r-- | helix-view/src/lib.rs | 1 |
5 files changed, 10 insertions, 14 deletions
diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index 812c803e..9ff2fd78 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -73,7 +73,7 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { #[cfg(target_os = "macos")] pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { - use crate::env::{binary_exists, env_var_is_set}; + use helix_stdx::env::{binary_exists, env_var_is_set}; if env_var_is_set("TMUX") && binary_exists("tmux") { command_provider! { @@ -98,7 +98,7 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { #[cfg(not(any(windows, target_os = "wasm32", target_os = "macos")))] pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { - use crate::env::{binary_exists, env_var_is_set}; + use helix_stdx::env::{binary_exists, env_var_is_set}; use provider::command::is_exit_success; // TODO: support for user-defined provider, probably when we have plugin support by setting a // variable? diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 388810b1..88653948 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -726,7 +726,12 @@ impl Document { if let Some((fmt_cmd, fmt_args)) = self .language_config() .and_then(|c| c.formatter.as_ref()) - .and_then(|formatter| Some((which::which(&formatter.command).ok()?, &formatter.args))) + .and_then(|formatter| { + Some(( + helix_stdx::env::which(&formatter.command).ok()?, + &formatter.args, + )) + }) { use std::process::Stdio; let text = self.text().clone(); diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index fbfcb356..f605cbb5 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -329,7 +329,7 @@ pub struct TerminalConfig { #[cfg(windows)] pub fn get_terminal_provider() -> Option<TerminalConfig> { - use crate::env::binary_exists; + use helix_stdx::env::binary_exists; if binary_exists("wt") { return Some(TerminalConfig { @@ -352,7 +352,7 @@ pub fn get_terminal_provider() -> Option<TerminalConfig> { #[cfg(not(any(windows, target_os = "wasm32")))] pub fn get_terminal_provider() -> Option<TerminalConfig> { - use crate::env::{binary_exists, env_var_is_set}; + use helix_stdx::env::{binary_exists, env_var_is_set}; if env_var_is_set("TMUX") && binary_exists("tmux") { return Some(TerminalConfig { diff --git a/helix-view/src/env.rs b/helix-view/src/env.rs deleted file mode 100644 index c68cc609..00000000 --- a/helix-view/src/env.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub fn binary_exists(binary_name: &str) -> bool { - which::which(binary_name).is_ok() -} - -#[cfg(not(windows))] -pub fn env_var_is_set(env_var_name: &str) -> bool { - std::env::var_os(env_var_name).is_some() -} diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs index 82827b5d..14b6e1ce 100644 --- a/helix-view/src/lib.rs +++ b/helix-view/src/lib.rs @@ -5,7 +5,6 @@ pub mod base64; pub mod clipboard; pub mod document; pub mod editor; -pub mod env; pub mod events; pub mod graphics; pub mod gutter; |