Skip to content

Commit

Permalink
Merge pull request #364 from itmecho/feature/skim-optional-exact
Browse files Browse the repository at this point in the history
Optional exact mode for skim
  • Loading branch information
denisidoro authored May 29, 2020
2 parents 317cc34 + 1d65f73 commit 95f746c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/finder/skim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ impl Finder for SkimFinder {
"--ansi",
"--bind",
"ctrl-j:down,ctrl-k:up",
"--exact",
]);

if opts.autoselect {
Expand Down Expand Up @@ -84,16 +83,27 @@ impl Finder for SkimFinder {
command.args(&["--header-lines", format!("{}", opts.header_lines).as_str()]);
}

let mut exact = true;

if let Some(o) = opts.overrides {
if o.contains("--no-exact") {
exact = false
}

o.as_str()
.split(' ')
.map(|s| s.to_string())
.filter(|s| !s.is_empty())
.filter(|s| s != "--no-exact")
.for_each(|s| {
command.arg(s);
});
}

if exact {
command.arg("--exact");
}

let child = command.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn();

let mut child = match child {
Expand Down

0 comments on commit 95f746c

Please sign in to comment.