Skip to content
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
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"language":"en","words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","hardlink","hardlinking","nlink","nlink","linemodes","SIGSTOP","sevenzip","rsplitn","replacen","DECSET","DECRQM","repeek","cwds","tcsi","Hyprland","Wayfire","SWAYSOCK","btime","nsec","codegen","gethostname","fchmod","fdfind","Rustc","rustc","Sysinfo","ffprobe","vframes","luma","obase","outln","errln","tmtheme","twox","cfgs","fstype","objc","rdev","runloop","exfat","rclone","DECRQSS","DECSCUSR"],"flagWords":[],"version":"0.2"}
{"version":"0.2","language":"en","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","peekable","ratatui","syntect","pbpaste","pbcopy","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","Konsole","Alacritty","Überzug","pkgs","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","hardlink","hardlinking","nlink","nlink","linemodes","SIGSTOP","sevenzip","rsplitn","replacen","DECSET","DECRQM","repeek","cwds","tcsi","Hyprland","Wayfire","SWAYSOCK","btime","nsec","codegen","gethostname","fchmod","fdfind","Rustc","rustc","ffprobe","vframes","luma","obase","outln","errln","tmtheme","twox","cfgs","fstype","objc","rdev","runloop","exfat","rclone","DECRQSS","DECSCUSR","libvterm"]}
11 changes: 4 additions & 7 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, NVIM};
use crate::Mux;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Brand {
Expand All @@ -20,7 +20,7 @@ pub enum Brand {
Hyper,
Mintty,
Tmux,
Neovim,
VTerm,
Apple,
Urxvt,
Bobcat,
Expand All @@ -36,6 +36,7 @@ impl Brand {
("foot", Self::Foot),
("ghostty", Self::Ghostty),
("tmux ", Self::Tmux),
("libvterm", Self::VTerm),
("Bobcat", Self::Bobcat),
];
names.into_iter().find(|&(n, _)| resp.contains(n)).map(|(_, b)| b)
Expand All @@ -44,10 +45,6 @@ impl Brand {
pub fn from_env() -> Option<Self> {
use Brand as B;

if NVIM.get() {
return Some(Self::Neovim);
}

let vars = [
("KITTY_WINDOW_ID", B::Kitty),
("KONSOLE_VERSION", B::Konsole),
Expand Down Expand Up @@ -112,7 +109,7 @@ impl Brand {
B::Hyper => &[A::Iip, A::Sixel],
B::Mintty => &[A::Iip],
B::Tmux => &[],
B::Neovim => &[],
B::VTerm => &[],
B::Apple => &[],
B::Urxvt => &[],
B::Bobcat => &[A::Iip, A::Sixel],
Expand Down
8 changes: 1 addition & 7 deletions yazi-adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ yazi_macro::mod_pub!(drivers);

yazi_macro::mod_flat!(adapter brand dimension emulator image info mux unknown);

use yazi_shared::{SyncCell, env_exists, in_wsl};
use yazi_shared::{SyncCell, in_wsl};

pub static EMULATOR: SyncCell<Emulator> = SyncCell::new(Emulator::unknown());
pub static ADAPTOR: SyncCell<Adapter> = SyncCell::new(Adapter::Chafa);
Expand All @@ -15,9 +15,6 @@ static SHOWN: SyncCell<Option<ratatui::layout::Rect>> = SyncCell::new(None);
// WSL support
pub static WSL: SyncCell<bool> = SyncCell::new(false);

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

// Tmux support
pub static TMUX: SyncCell<bool> = SyncCell::new(false);
static ESCAPE: SyncCell<&'static str> = SyncCell::new("\x1b");
Expand All @@ -28,9 +25,6 @@ pub fn init() -> anyhow::Result<()> {
// WSL support
WSL.set(in_wsl());

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

// Emulator detection
EMULATOR.set(Emulator::detect().unwrap_or_default());
TMUX.set(EMULATOR.get().kind.is_left_and(|&b| b == Brand::Tmux));
Expand Down
6 changes: 3 additions & 3 deletions yazi-adapter/src/mux.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use anyhow::Result;
use tracing::error;

use crate::{CLOSE, ESCAPE, Emulator, NVIM, START, TMUX};
use crate::{CLOSE, ESCAPE, Emulator, START, TMUX};

pub struct Mux;

impl Mux {
pub fn csi(s: &str) -> std::borrow::Cow<str> {
if TMUX.get() && !NVIM.get() {
if TMUX.get() {
std::borrow::Cow::Owned(format!(
"{START}{}{CLOSE}",
s.trim_start_matches('\x1b').replace('\x1b', ESCAPE.get()),
Expand Down Expand Up @@ -41,7 +41,7 @@ impl Mux {
}

pub fn tmux_drain() -> Result<()> {
if TMUX.get() && !NVIM.get() {
if TMUX.get() {
crossterm::execute!(std::io::stderr(), crossterm::style::Print(Mux::csi("\x1b[5n")))?;
_ = futures::executor::block_on(Emulator::read_until_dsr());
}
Expand Down
4 changes: 0 additions & 4 deletions yazi-boot/src/actions/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ impl Actions {
writeln!(s, "\nWSL")?;
writeln!(s, " WSL: {:?}", yazi_adapter::WSL.get())?;

writeln!(s, "\nNeovim")?;
writeln!(s, " NVIM : {}", yazi_adapter::NVIM.get())?;
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
Loading