From 5028ef4d0b29ae5113482b4f95841e0168b6e856 Mon Sep 17 00:00:00 2001 From: d Date: Thu, 12 Mar 2026 13:19:25 +0300 Subject: [PATCH] chore: correct typos in code, comments and documentation (#1002) * fix: correct typos in code, comments and documentation * chore: generate completions & manpage --------- Co-authored-by: Skim bot --- README.md | 2 +- bin/sk-tmux | 2 +- man/man1/sk.1 | 4 ++-- src/helper/item.rs | 22 +++++++++++----------- src/item.rs | 2 +- src/lib.rs | 17 +++++++++++++---- src/skim.rs | 4 ++-- src/tui/item_list.rs | 2 +- src/tui/preview.rs | 2 +- 9 files changed, 33 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 20ae5b7b..0b2ef2c2 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ page](https://github.com/skim-rs/skim/blob/master/man/man1/sk.1) (`man sk`). - When using the `--split-match` option, each part around spaces or `|` will be matched in a split way: - If the option's value (defaulting to `:`) is absent from the query, do a normal match - - If it is present, match everything before to everything before it in the items, and everything after it (including potential other occurences of the delimiter) to the part after it in the items. This is particularly useful when piping in input from `rg` to match on both file name and content. + - If it is present, match everything before to everything before it in the items, and everything after it (including potential other occurrences of the delimiter) to the part after it in the items. This is particularly useful when piping in input from `rg` to match on both file name and content. If you prefer using regular expressions, `skim` offers a `regex` mode: diff --git a/bin/sk-tmux b/bin/sk-tmux index 83e83277..8de4b8cb 100755 --- a/bin/sk-tmux +++ b/bin/sk-tmux @@ -28,7 +28,7 @@ # sk-tmux: starts sk in a tmux pane # usage: sk-tmux [LAYOUT OPTIONS] [--] [SK OPTIONS] -echo "[WRN] This script is deprecated in favor or \`sk --tmux\` and will be removed in a later release" >&2 +echo "[WRN] This script is deprecated in favor of \`sk --tmux\` and will be removed in a later release" >&2 fail() { >&2 echo "$1" diff --git a/man/man1/sk.1 b/man/man1/sk.1 index 6d89741a..4684da01 100644 --- a/man/man1/sk.1 +++ b/man/man1/sk.1 @@ -83,9 +83,9 @@ Start in regex mode instead of fuzzy\-match Fuzzy matching algorithm arinae (ari) Latest algorithm -skim_v2 Legacy skim algorithm +`skim_v2` Legacy skim algorithm clangd Used in clangd for keyword completion -fzy Algorithm from fzy (https://github.com/jhawthorn/fzy) +fzy Algorithm from fzy () .br .br diff --git a/src/helper/item.rs b/src/helper/item.rs index 31fe20a8..723f3d28 100644 --- a/src/helper/item.rs +++ b/src/helper/item.rs @@ -315,7 +315,7 @@ impl SkimItem for DefaultSkimItem { // Combine styles: use highlight bg, preserve ANSI fg and modifiers new_spans.push(Span::styled( highlighted_content.clone(), - merge_styles(base_style, context.matched_syle), + merge_styles(base_style, context.matched_style), )); highlighted_content.clear(); } @@ -336,7 +336,7 @@ impl SkimItem for DefaultSkimItem { // Combine styles: use highlight bg, preserve ANSI fg and modifiers new_spans.push(Span::styled( highlighted_content, - merge_styles(base_style, context.matched_syle), + merge_styles(base_style, context.matched_style), )); } } @@ -373,10 +373,10 @@ impl SkimItem for DefaultSkimItem { new_spans.push(Span::styled(before, merge_styles(context.base_style, base_style))); } if !highlighted.is_empty() { - // Combine ANSI style with context matched_syle + // Combine ANSI style with context matched_style new_spans.push(Span::styled( highlighted, - merge_styles(base_style, context.matched_syle), + merge_styles(base_style, context.matched_style), )); } if !after.is_empty() { @@ -421,10 +421,10 @@ impl SkimItem for DefaultSkimItem { new_spans.push(Span::styled(before, merge_styles(context.base_style, base_style))); } if !highlighted.is_empty() { - // Combine ANSI style with context matched_syle + // Combine ANSI style with context matched_style new_spans.push(Span::styled( highlighted, - merge_styles(base_style, context.matched_syle), + merge_styles(base_style, context.matched_style), )); } if !after.is_empty() { @@ -667,7 +667,7 @@ mod test { matches: Matches::CharRange(6, 10), container_width: 80, base_style: Style::default(), - matched_syle: Style::default().fg(Color::Yellow), + matched_style: Style::default().fg(Color::Yellow), }; // display() should map the match positions back to the original ANSI text @@ -705,7 +705,7 @@ mod test { matches: Matches::CharIndices(vec![1, 2]), container_width: 80, base_style: Style::default(), - matched_syle: Style::default().fg(Color::Yellow), + matched_style: Style::default().fg(Color::Yellow), }; // display() should map these to positions 6,7 in original text @@ -772,7 +772,7 @@ mod test { matches: Matches::CharIndices(vec![0]), container_width: 80, base_style: Style::default(), - matched_syle: Style::default().bg(Color::Yellow), + matched_style: Style::default().bg(Color::Yellow), }; let line = item.display(context); @@ -810,7 +810,7 @@ mod test { matches: Matches::CharRange(1, 3), container_width: 80, base_style: Style::default(), - matched_syle: Style::default().bg(Color::Yellow), + matched_style: Style::default().bg(Color::Yellow), }; let line = item.display(context); @@ -850,7 +850,7 @@ mod test { matches: Matches::ByteRange(1, 3), container_width: 80, base_style: Style::default(), - matched_syle: Style::default().bg(Color::Yellow), + matched_style: Style::default().bg(Color::Yellow), }; let line = item.display(context); diff --git a/src/item.rs b/src/item.rs index 87bc5205..79d7b5ea 100644 --- a/src/item.rs +++ b/src/item.rs @@ -63,7 +63,7 @@ impl RankBuilder { /// /// The values are stored as-is; the tiebreak ordering and sign-flipping are /// applied lazily by [`Rank::sort_key`] at comparison time. - /// The `index` will be overriden later + /// The `index` will be overridden later #[must_use] pub fn build_rank(&self, score: i32, begin: usize, end: usize, item_text: &str) -> Rank { Rank { diff --git a/src/lib.rs b/src/lib.rs index 4a38dcad..92767dc1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,7 +122,7 @@ pub struct DisplayContext { /// The base style to apply to non-matched portions pub base_style: Style, /// The style to apply to matched portions - pub matched_syle: Style, + pub matched_style: Style, } impl DisplayContext { @@ -147,7 +147,10 @@ impl DisplayContext { res.push_span(Span::styled(span_content.collect::(), self.base_style)); let highlighted_char = chars.next().unwrap_or_default().to_string(); - res.push_span(Span::styled(highlighted_char, self.base_style.patch(self.matched_syle))); + res.push_span(Span::styled( + highlighted_char, + self.base_style.patch(self.matched_style), + )); prev_index = index + 1; } res.push_span(Span::styled(chars.collect::(), self.base_style)); @@ -164,7 +167,10 @@ impl DisplayContext { )); let highlighted_text = chars.by_ref().take(*end - *start).collect::(); - res.push_span(Span::styled(highlighted_text, self.base_style.patch(self.matched_syle))); + res.push_span(Span::styled( + highlighted_text, + self.base_style.patch(self.matched_style), + )); res.push_span(Span::styled(chars.collect::(), self.base_style)); res } @@ -178,7 +184,10 @@ impl DisplayContext { let highlighted_bytes = bytes.by_ref().take(*end - *start).collect(); let highlighted_text = String::from_utf8(highlighted_bytes).unwrap(); - res.push_span(Span::styled(highlighted_text, self.base_style.patch(self.matched_syle))); + res.push_span(Span::styled( + highlighted_text, + self.base_style.patch(self.matched_style), + )); res.push_span(Span::styled( String::from_utf8(bytes.collect()).unwrap(), self.base_style, diff --git a/src/skim.rs b/src/skim.rs index 8c8afa32..bbabdf30 100644 --- a/src/skim.rs +++ b/src/skim.rs @@ -52,7 +52,7 @@ impl Skim { /// /// # Panics /// - /// Panics if the tui fails to initilize + /// Panics if the tui fails to initialize pub fn run_with(options: SkimOptions, source: Option) -> Result { trace!("running skim"); let mut skim = Self::init(options, source)?; @@ -348,7 +348,7 @@ where let reader_control = self .reader_control .as_ref() - .expect("reader_control needs to be initilized using Skim::start"); + .expect("reader_control needs to be initialized using Skim::start"); let app = &mut self.app; // Filter mode: wait for all items to be read and matched, then return without entering TUI diff --git a/src/tui/item_list.rs b/src/tui/item_list.rs index 28dae9d7..84fba8a1 100644 --- a/src/tui/item_list.rs +++ b/src/tui/item_list.rs @@ -724,7 +724,7 @@ impl SkimWidget for ItemList { matches, container_width, base_style: if is_current { theme.current } else { theme.normal }, - matched_syle: if is_current { theme.current_match } else { theme.matched }, + matched_style: if is_current { theme.current_match } else { theme.matched }, }); if !wrap { diff --git a/src/tui/preview.rs b/src/tui/preview.rs index 9f00d38e..c731d384 100644 --- a/src/tui/preview.rs +++ b/src/tui/preview.rs @@ -303,7 +303,7 @@ impl Preview { self.rows, self.cols ); self.init_pty(); - trace!("initalized pty"); + trace!("initialized pty"); let mut shell_cmd = portable_pty::CommandBuilder::new("/bin/sh"); shell_cmd.env("ROWS", self.rows.to_string()); shell_cmd.env("COLUMNS", self.cols.to_string());