From aeb957a2852555b2fce037aac4c3cb2b9d2f5c39 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 4 Oct 2016 02:09:03 +0900 Subject: Use exact match by default for inverse search term This is a breaking change, but I believe it makes much more sense. It is almost impossible to predict which entries will be filtered out due to a fuzzy inverse term. You can still perform inverse-fuzzy-match by prepending `!'` to the term. | Token | Match type | Description | | -------- | -------------------------- | --------------------------------- | | `sbtrkt` | fuzzy-match | Items that match `sbtrkt` | | `^music` | prefix-exact-match | Items that start with `music` | | `.mp3$` | suffix-exact-match | Items that end with `.mp3` | | `'wild` | exact-match (quoted) | Items that include `wild` | | `!fire` | inverse-exact-match | Items that do not include `fire` | | `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` | --- src/pattern.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/pattern.go') diff --git a/src/pattern.go b/src/pattern.go index 7e5f4289..82272af6 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -163,12 +163,13 @@ func parseTerms(fuzzy bool, caseMode Case, str string) []termSet { if strings.HasPrefix(text, "!") { inv = true + typ = termExact text = text[1:] } if strings.HasPrefix(text, "'") { // Flip exactness - if fuzzy { + if fuzzy && !inv { typ = termExact text = text[1:] } else { -- cgit v1.2.3