Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add score to the tiebreak on ^R keybindings #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m-wynn
Copy link

@m-wynn m-wynn commented Feb 17, 2021

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant