skim icon indicating copy to clipboard operation
skim copied to clipboard

Add score to the tiebreak on ^R keybindings

Open m-wynn opened this issue 4 years ago • 0 comments

Skim's --tiebreak=index will match if the letters in the query appear in the text. E.g. searching for "hello" in the following text will match on the long line that does not contain "hello" first.

$ echo "hotel echo lima lima oscar\nhello" | sk --tiebreak=index

  hello
> hotel echo lima lima oscar
  2/2
> hello

This differs from fzf, which will still prioritize an exact word match.

$ echo "hotel echo lima lima oscar\nhello" | fzf --tiebreak=index

  hotel echo lima lima oscar
> hello
  2/2
> hello

This breaks ^R in complex histories, where long commands may be run which contain all the letters in the right order in the searched string, but are completely unrelated to the user's query. The user will have to preface the query with ' every time in order to get a usable result.

Because of this skim needs to either prioritize whole-word matches even when --tiebreak=index or the ^R bindings need to tiebreak on score before index. This commit chooses the latter.

m-wynn avatar Feb 17 '21 19:02 m-wynn