Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable passthrough when the user launches Yazi in Neovim inside tmux #2014

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
cargo publish -p yazi-macro
sleep 30
cargo publish -p yazi-codegen
sleep 30
cargo publish -p yazi-shared
sleep 30
cargo publish -p yazi-fs
sleep 30
cargo publish -p yazi-config
sleep 30
cargo publish -p yazi-proxy
sleep 30
cargo publish -p yazi-fs
sleep 30
cargo publish -p yazi-adapter
sleep 30
cargo publish -p yazi-boot
Expand Down
4 changes: 2 additions & 2 deletions yazi-adapter/src/brand.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use tracing::warn;
use yazi_shared::env_exists;

use crate::Mux;
use crate::{Mux, NVIM};

#[derive(Clone, Copy, Debug)]
pub enum Brand {
Expand All @@ -27,7 +27,7 @@ impl Brand {
pub fn from_env() -> Option<Self> {
use Brand as B;

if env_exists("NVIM_LOG_FILE") && env_exists("NVIM") {
if *NVIM {
return Some(Self::Neovim);
}

Expand Down
6 changes: 6 additions & 0 deletions yazi-adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ static CLOSE: RoCell<&'static str> = RoCell::new();
// WSL support
pub static WSL: RoCell<bool> = RoCell::new();

// Neovim support
pub static NVIM: RoCell<bool> = RoCell::new();

pub fn init() -> anyhow::Result<()> {
// Tmux support
TMUX.init(env_exists("TMUX_PANE") && env_exists("TMUX"));
Expand All @@ -40,6 +43,9 @@ pub fn init() -> anyhow::Result<()> {
// WSL support
WSL.init(in_wsl());

// Neovim support
NVIM.init(env_exists("NVIM_LOG_FILE") && env_exists("NVIM"));

EMULATOR.init(Emulator::detect());
yazi_config::init_flavor(EMULATOR.light)?;

Expand Down
4 changes: 2 additions & 2 deletions yazi-adapter/src/mux.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{CLOSE, ESCAPE, START, TMUX};
use crate::{CLOSE, ESCAPE, NVIM, START, TMUX};

pub struct Mux;

impl Mux {
pub fn csi(s: &str) -> std::borrow::Cow<str> {
if *TMUX {
if *TMUX && !*NVIM {
std::borrow::Cow::Owned(format!(
"{}{}{}",
*START,
Expand Down
4 changes: 4 additions & 0 deletions yazi-boot/src/actions/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ impl Actions {
writeln!(s, "\nWSL")?;
writeln!(s, " WSL: {:?}", *yazi_adapter::WSL)?;

writeln!(s, "\nNVIM")?;
writeln!(s, " NVIM : {:?}", *yazi_adapter::NVIM)?;
writeln!(s, " Neovim version: {:?}", Self::process_output("nvim", "--version"))?;

writeln!(s, "\nVariables")?;
writeln!(s, " SHELL : {:?}", env::var_os("SHELL"))?;
writeln!(s, " EDITOR : {:?}", env::var_os("EDITOR"))?;
Expand Down
2 changes: 1 addition & 1 deletion yazi-codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ proc-macro = true

[dependencies]
# External dependencies
syn = "2.0.90"
syn = { version = "2.0.90", features = [ "full" ] }
quote = "1.0.37"
Loading