Skip to content
t9md edited this page Mar 11, 2017 · 7 revisions

Overview

  • Used to filter items on narrow-editor.
  • You can input query on first line of narrow-editor.
  • Basically query is matched as-is
    • No regular expression support currently.
    • Meta character for regular expression is auto-excaped.
  • Can chain multiple query separating by whilte-space.
    • e.g. foo bar means, select items matches foo and bar.
  • See also Query expressiveness.
  • General rule: white-space is treated as AND, | is treated as OR,
  • Exception: First query on narrow:scan is NOT evaluated as query as described in this page.
    • In narrow:scan, when you input aaa bbb ccc in query area.
      • aaa is searched by editor.scan as literally, out-of-scope of query expression.
      • bbb ccc is treated as query

AND: chain word separated by white-space

  • Query: aaa bbb ccc means, "matches item which include aaa AND bbb AND ccc"(no order matter).

OR: chain word separated by |.

  • Query: aaa|bbb matches items include aaa OR bbb.
  • Query: a|b|c d means, matches items ((a OR b OR c) AND d).
    • General rule: | is treated as OR, white-space is always treated as AND.
  • Limitation: You can NOT use !( negate ) expression in each segment.
    • !a|b is evaluated as !(a|b), means "matches items include neither a nor b."
    • !a|!b is evaluated as !(a|!b), ! in !b is not evaluated as negate( which is not what you expect ).
  • Exception: When query starts or ends with | char, | is NOT evaluated as OR.
    • e.g. |, ||, |a, a|, |a|b , a|b|, |a|b|, all searched as-is(literally), | is not evaluated as OR.

Case sensitivity

  • Query case sensitivity is configurable with config caseSensitivityForNarrowQuery.
    • Can override global setting on each provider if you want.
  • smartcase is determined by each query.

Wildcard by *

  • * is treated as wildcard, internally converted to .* regular expression.
    • To search * itself, use * solely separate it by space.
    • Or use double **. ( e.g. To match to string *hello use **hello as query).

Negate by ! starting or ending( optional ) query

  • ! is treated as negate, !foo means 'not matching foo'.
    • If config negateNarrowQueryByEndingExclamation set to true, you can also use foo!.
  • Query case sensitivity is configurable with config caseSensitivityForNarrowQuery.
    • Can override global setting on each provider if you want.

Word-boundary by > and <

  • Prepend > to match word-boundary( \b ) at beginning of query
  • Append < to match word-boundary( \b ) at end of query
  • \b boundary is NOT appended when \b is useless.(e.g. \b= match nothing)
  • Regardless of uselessness or not, beginning > and ending < are initenally removed from query.
  • Translation example
    • >word< to \bword\b
    • >word to \bword
    • word< to word\b
    • >= to = ( because \b is useless )
    • =< to = ( because \b is useless )
    • >>= to >= ( because \b is useless )
    • =<< to =< ( because \b is useless )