Skip to content

Commit

Permalink
Fix preview-var when using fish (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro authored Jun 15, 2021
1 parent 4ac39e8 commit 7257845
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ fn prompt_finder(

let exe = fs::exe_string();

let subshell_prefix = if CONFIG.shell().contains("fish") { "" } else { "$" };

let preview = if cfg!(target_os = "windows") {
format!(
r#"(@echo.{{+}}{eof}{{q}}{eof}{name}{eof}{extra}) | {exe} preview-var-stdin"#,
Expand All @@ -87,15 +89,16 @@ fn prompt_finder(
)
} else {
format!(
r#"{exe} preview-var "$(cat <<{eof}
r#"{exe} preview-var "{subshell_prefix}(cat <<{eof}
{{+}}
{eof}
)" "$(cat <<{eof}
)" "{subshell_prefix}(cat <<{eof}
{{q}}
{eof}
)" "{name}"; {extra}"#,
exe = exe,
name = variable_name,
subshell_prefix = subshell_prefix,
extra = extra_preview
.clone()
.map(|e| format!(" echo; {}", e))
Expand Down

0 comments on commit 7257845

Please sign in to comment.