Skip to content

Commit b9b64e6

Browse files
authored
chore: frizbee as a feature and remove quotes from output-format (#1062)
* fix: remove quotes from output-format * chore: add frizbee feature
1 parent cf49f60 commit b9b64e6

10 files changed

Lines changed: 86 additions & 56 deletions

File tree

.envrc.local

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ __pycache__/
3232

3333
# Vagrant
3434
.vagrant/
35+
36+
.envrc.local
37+
/public

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@ edition = "2024"
1313
rust-version = "1.91"
1414
default-run = "sk"
1515

16-
[package.metadata.wix]
17-
upgrade-guid = "6DDAED06-EBE2-41C4-94F5-CB03F2A4B92E"
18-
path-guid = "05D1A327-19E0-4C82-B5EC-6B28E40C691B"
19-
license = false
20-
eula = false
16+
[lib]
17+
name = "skim"
18+
path = "src/lib.rs"
19+
20+
[[bin]]
21+
name = "sk"
22+
path = "src/bin/main.rs"
23+
required-features = ["cli"]
24+
25+
[features]
26+
# Default is destined to the CLI, not to library usage.
27+
default = ["cli", "frizbee"]
28+
# Everyting needed to use skim as a cli (argument parsing, shell integrations...). This should not be needed for most libraries.
29+
cli = ["dep:clap", "dep:clap_complete", "dep:shlex", "dep:env_logger", "dep:clap_mangen"]
30+
# Include frizbee as a matching algorithm
31+
frizbee = ["dep:frizbee"]
32+
# Enable gungraun (Valgrind-based) benchmarks
33+
gungraun = ["dep:gungraun"]
2134

2235
[profile.release]
2336
lto = true
@@ -34,64 +47,51 @@ inherits = "release"
3447
debug = true
3548
strip = false
3649

37-
38-
[lib]
39-
name = "skim"
40-
path = "src/lib.rs"
41-
42-
[[bin]]
43-
name = "sk"
44-
path = "src/bin/main.rs"
45-
required-features = ["cli"]
46-
4750
[dependencies]
4851
ansi-to-tui = "8.0.1"
49-
assert_enum_variants = "=0.1.2"
52+
assert_enum_variants = "0.1.2"
5053
clap = { version = "4.6.0" , optional = true, features = ["cargo", "derive", "unstable-markdown"] }
5154
clap_complete = { version = "4.6.0", optional = true }
5255
clap_complete_nushell = "4.6.0"
53-
clap_mangen = { version = "=0.3.0", optional = true }
54-
color-eyre = "=0.6.5"
56+
clap_mangen = { version = "0.3.0", optional = true }
57+
color-eyre = "0.6.5"
58+
# Crossterm's version is selected by ratatui
5559
crossterm = { version = ">=0.0.0", features = ["event-stream", "use-dev-tty", "libc"] }
56-
derive_builder = "=0.20.2"
60+
derive_builder = "0.20.2"
5761
derive_more = { version = "2.1.1", features = ["debug", "eq"] }
5862
env_logger = { version = "0.11.10", optional = true, features = ["humantime"] }
59-
futures = "=0.3.32"
63+
futures = "0.3.32"
6064
gungraun = { version = "0.18.1", optional = true }
6165
indexmap = "2.13.1"
6266
interprocess = { version = "2.4.0", features = ["tokio"] }
63-
kanal = "=0.1.1"
67+
kanal = "0.1.1"
6468
log = "0.4.29"
6569
memchr = "2.8.0"
6670
mimalloc = { version = "0.1.48", features = ["v3"] }
6771
nix = { version = "0.31.2", features = ["fs", "poll"] }
68-
portable-pty = "=0.9.0"
72+
portable-pty = "0.9.0"
6973
ratatui = "0.30.0"
7074
regex = "1.12.3"
7175
roff = "1.1.1"
72-
ron = "=0.12.1"
76+
ron = "0.12.1"
7377
serde = { version = "1.0.228", features = ["derive"] }
74-
shell-quote = "=0.7.2"
75-
shlex = { version = "=1.3.0", optional = true }
78+
shell-quote = "0.7.2"
79+
shlex = { version = "1.3.0", optional = true }
7680
tempfile = "3.27.0"
7781
thiserror = "2.0.18"
7882
thread_local = "1.1.9"
7983
tokio = { version = "1.51.0", features = ["macros", "net", "rt-multi-thread", "sync", "time", "tokio-macros"] }
80-
tokio-util = "=0.7.18"
81-
tui-term = "=0.3.4"
82-
unicode-display-width = "=0.3.0"
83-
unicode-normalization = "=0.1.25"
84+
tokio-util = "0.7.18"
85+
tui-term = "0.3.4"
86+
unicode-display-width = "0.3.0"
87+
unicode-normalization = "0.1.25"
8488
which = "8.0.2"
8589

8690
[target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies]
87-
frizbee = { version = "=0.9.0" }
91+
frizbee = { version = "=0.9.0", optional = true }
8892

89-
[features]
90-
default = ["cli"]
91-
# Everyting needed to use skim as a cli (argument parsing, shell integrations...)
92-
cli = ["dep:clap", "dep:clap_complete", "dep:shlex", "dep:env_logger", "dep:clap_mangen"]
93-
# Enable gungraun (Valgrind-based) benchmarks
94-
gungraun = ["dep:gungraun"]
93+
[build-dependencies]
94+
cfg_aliases = "0.2.1"
9595

9696
[dev-dependencies]
9797
criterion = { version = "0.8.2", features = ["async_tokio"] }
@@ -129,3 +129,9 @@ required-features = ["gungraun"]
129129
name = "cli"
130130
harness = false
131131
bench = false
132+
133+
[package.metadata.wix]
134+
upgrade-guid = "6DDAED06-EBE2-41C4-94F5-CB03F2A4B92E"
135+
path-guid = "05D1A327-19E0-4C82-B5EC-6B28E40C691B"
136+
license = false
137+
eula = false

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use cfg_aliases::cfg_aliases;
2+
3+
fn main() {
4+
// Setup cfg aliases
5+
cfg_aliases! {
6+
// Platforms
7+
frizbee_simd: { any(target_arch = "x86_64", target_arch = "aarch64") },
8+
// Backends
9+
frizbee: { all(feature = "frizbee", frizbee_simd) }
10+
}
11+
}

man/man1/sk.1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ Start in regex mode instead of fuzzy\-match
108108
\fB\-\-algo\fR \fI<ALGORITHM>\fR [default: arinae]
109109
Fuzzy matching algorithm
110110

111-
arinae (ari) Latest algorithm
112-
`skim_v2` Legacy skim algorithm
113-
clangd Used in clangd for keyword completion
114-
fzy Algorithm from fzy (<https://github.com/jhawthorn/fzy>)
111+
\- arinae (ari) Latest algorithm
112+
113+
\- `skim_v2` Legacy skim algorithm
114+
115+
\- clangd Used in clangd for keyword completion
116+
117+
\- fzy Algorithm from fzy (<https://github.com/jhawthorn/fzy>)
118+
119+
\- frizbee Algorithm used in the blink.cmp neovim plugin, supported on aarch64 and x86 only
115120
.br
116121

117122
.br

src/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn sk_main(mut opts: SkimOptions) -> Result<i32> {
204204
&result.current,
205205
&result.query,
206206
&result.cmd,
207-
true
207+
false
208208
),
209209
bin_options.output_ending
210210
)?;

src/engine/fuzzy.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt::{Display, Error, Formatter};
33
use std::sync::Arc;
44

55
use crate::fuzzy_matcher::arinae::ArinaeMatcher;
6-
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
6+
#[cfg(frizbee)]
77
use crate::fuzzy_matcher::frizbee::FrizbeeMatcher;
88
use crate::fuzzy_matcher::{FuzzyMatcher, clangd::ClangdMatcher, fzy::FzyMatcher, skim::SkimMatcherV2};
99

@@ -17,19 +17,19 @@ use crate::{MatchRange, MatchResult, SkimItem};
1717
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
1818
#[cfg_attr(feature = "cli", clap(rename_all = "snake_case"))]
1919
pub enum FuzzyAlgorithm {
20-
/// Improved skim fuzzy matching algorithm (v2)
21-
SkimV2,
20+
/// Arinae: typo-resistant & natural algorithm, default
21+
#[cfg_attr(feature = "cli", clap(alias = "ari"))]
22+
#[default]
23+
Arinae,
2224
/// Clangd fuzzy matching algorithm
2325
Clangd,
2426
/// Fzy matching algorithm (<https://github.com/jhawthorn/fzy>)
2527
Fzy,
2628
/// Frizbee matching algorithm, typo resistant (`x86_64` and `aarch64` only)
27-
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
29+
#[cfg(frizbee)]
2830
Frizbee,
29-
/// Arinae: typo-resistant & natural algorithm, default
30-
#[cfg_attr(feature = "cli", clap(alias = "ari"))]
31-
#[default]
32-
Arinae,
31+
/// Previous skim fuzzy matching algorithm (v2)
32+
SkimV2,
3333
}
3434

3535
const BYTES_1M: usize = 1024 * 1024 * 1024;
@@ -127,7 +127,7 @@ impl FuzzyEngineBuilder {
127127
debug!("Initialized Clangd algorithm");
128128
Box::new(matcher)
129129
}
130-
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
130+
#[cfg(frizbee)]
131131
FuzzyAlgorithm::Frizbee => Box::new(FrizbeeMatcher::default().case(self.case).max_typos(max_typos)),
132132
FuzzyAlgorithm::Fzy => {
133133
let matcher = FzyMatcher::default().max_typos(max_typos);

src/fuzzy_matcher/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
pub mod arinae;
88
/// Clangd fuzzy matching algorithm
99
pub mod clangd;
10-
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
10+
#[cfg(frizbee)]
1111
pub mod frizbee;
1212
/// Fzy fuzzy matching algorithm
1313
pub mod fzy;

src/options.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,15 @@ pub struct SkimOptions {
173173

174174
/// Fuzzy matching algorithm
175175
///
176-
/// arinae (ari) Latest algorithm
177-
/// `skim_v2` Legacy skim algorithm
178-
/// clangd Used in clangd for keyword completion
179-
/// fzy Algorithm from fzy (<https://github.com/jhawthorn/fzy>)
176+
/// - arinae (ari) Latest algorithm
177+
///
178+
/// - `skim_v2` Legacy skim algorithm
179+
///
180+
/// - clangd Used in clangd for keyword completion
181+
///
182+
/// - fzy Algorithm from fzy (<https://github.com/jhawthorn/fzy>)
183+
///
184+
/// - frizbee Algorithm used in the blink.cmp neovim plugin, supported on aarch64 and x86 only
180185
#[cfg_attr(
181186
feature = "cli",
182187
arg(

0 commit comments

Comments
 (0)