Skip to content
Myr

Make it possible to unquote the term in extended-exact mode

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #338

authored by Junegunn Choi · committed by Junegunn Choi · parent 0a22142 · Browse files · 3 files+7 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+7 added−3 removed

  • other:+7 added−3 removed

3 files+7 added−3 removed

modified:src/pattern_test.go+2 added-2 removed
35 unmodified lines
36 terms := parseTerms(ModeExtendedExact, CaseSmart,37 "aaa 'bbb ^ccc ddd$ !eee !'fff !^ggg !hhh$")38 if len(terms) != 8 ||39 terms[0].typ != termExact || terms[0].inv || len(terms[0].text) != 3 ||40 terms[1].typ != termExact || terms[1].inv || len(terms[1].text) != 4 ||40 terms[1].typ != termFuzzy || terms[1].inv || len(terms[1].text) != 3 ||41 terms[2].typ != termPrefix || terms[2].inv || len(terms[2].text) != 3 ||42 terms[3].typ != termSuffix || terms[3].inv || len(terms[3].text) != 3 ||43 terms[4].typ != termExact || !terms[4].inv || len(terms[4].text) != 3 ||44 terms[5].typ != termExact || !terms[5].inv || len(terms[5].text) != 4 ||44 terms[5].typ != termFuzzy || !terms[5].inv || len(terms[5].text) != 3 ||45 terms[6].typ != termPrefix || !terms[6].inv || len(terms[6].text) != 3 ||46 terms[7].typ != termSuffix || !terms[7].inv || len(terms[7].text) != 3 {47 t.Errorf("%s", terms)48 }
84 unmodified lines
modified:src/pattern.go+3 added
149 unmodified lines
150 if strings.HasPrefix(text, "'") {151 if mode == ModeExtended {152 typ = termExact153 text = text[1:]154 } else if mode == ModeExtendedExact {155 typ = termFuzzy156 text = text[1:]157 }158 } else if strings.HasPrefix(text, "^") {159 if strings.HasSuffix(text, "$") {160 typ = termEqual
176 unmodified lines
modified:README.md+2 added-1 removed
123 unmodified lines
124| `'wild` | Items that include `wild` | exact-match (quoted) |125| `!'fire` | Items that do not include `fire` | inverse-exact-match |126127If you don't need fuzzy matching and do not wish to "quote" every word, start128fzf with `-e` or `--extended-exact` option.128fzf with `-e` or `--extended-exact` option. Note that in `--extended-exact`129mode, `'`-prefix "unquotes" the term.130131#### Environment variables132133- `FZF_DEFAULT_COMMAND`
247 unmodified lines