denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
14.61k stars 489 forks source link

The preview format used on Windows is only for "cmd.exe". #896

Open UnderCooled opened 1 month ago

UnderCooled commented 1 month ago
diff --git a/src/commands/core/actor.rs b/src/commands/core/actor.rs
index 91a1846..ae3d413 100644
--- a/src/commands/core/actor.rs
+++ b/src/commands/core/actor.rs
@@ -63,7 +63,7 @@ fn prompt_finder(

     let exe = fs::exe_string();

-    let preview = if cfg!(target_os = "windows") {
+    let preview = if CONFIG.shell().contains("cmd.exe") {
         format!(
             r#"(@echo.{{+}}{eof}{{q}}{eof}{name}{eof}{extra}) | {exe} preview-var-stdin"#,
             exe = exe,

So after this modification, FZF preview will use the right way to communicate with other shells. I set config.yaml shell command to elvish or nushell, they work OK with the default preview format.

Pwsh will still show an error, so it needs another preview format, but it is too slow to be used as a preview shell anyway.

welcome[bot] commented 1 month ago

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)