completion - chimay/wheel GitHub Wiki

<!-- vim: set filetype=markdown: -->

Introduction

When a wheel function needs to prompt the user for input, it offers completion wherever possible. The completion type depends of course on the nature of the asked entry :

  • location, circle or torus
  • file, directory, buffer
  • tag
  • and so on

Hitting 'wildchar' (most likely <tab>), will trigger the completion.

If pum is in wildoptions, the choices will be displayed in a nice pop-up menu.

Multi-patterns

You can enter one or more patterns before hitting 'wildchar' to narrow the completion list :

  • a space between two patterns is a logical and. So, one two will display candidates containing both one and two
  • a pipe | between two patterns is a logical or. So, one|two will display candidates containing one or two
  • a bang ! beginning a filtering pattern is a logical not : all candidates matching this pattern will be removed from the list

Here, one and two can be any vim regex. Most of the time, they are simply litteral parts of the wanted result.

Example

For example, if you have the completion list small flower, big flower, small fruit and big fruit :

  • the pattern fl will narrow down to small flower, big flower
  • the pattern sm will narrow down to small flower, small fruit
  • the patterns sm fl will narrow down to small flower
  • the patterns all !ower will narrow down to small fruit
  • the patterns al|owe will narrow down to small flower, small fruit, big flower

Builtin patterns

All builtin patterns remain available.

If you want a classic completion matching only at the beginning of the string, you can use ^. For example, if you have the completion list small flower, sunflower, flower, small fruit, big fruit and fruit :

  • the pattern ^f will narrow down to flower, fruit
  • the pattern ^s will narrow down to small flower, sunflower, small fruit

Vowels fuzzy

If g:wheel_config.completion.vocalize is greater than 0, the plugin adds vowels patterns between the chars you enter, to enable a kind of vowels-fuzzy completion.

This way, if you have the completion list profile, proof, wheel and organize :

  • the pattern prf will narrow down to profile, proof
  • the pattern hl will narrow down to wheel
  • the pattern gn will narrow down to organize

Kind of a step between classic & full fuzzy completion.

Word fuzzy

If g:wheel_config.completion.wordize is greater than 0, the plugin adds word-characterss patterns between the chars you enter, to enable a kind of word-fuzzy completion.

This way, if you have the completion list profile, proof, wheel and organize :

  • the pattern pof will narrow down to profile, proof
  • the pattern we will narrow down to wheel
  • the pattern oai will narrow down to organize

Scores

If g:wheel_config.completion.scores is greater than 0, scores are computed, and matching results are sorted accordingly.

Fuzzy

If g:wheel_config.completion.fuzzy is greater than 0, a full fuzzy completion is enabled, using matchfuzzy(). Beware that the or | operator is not available in this mode.

File completion

Files and directories completes in different ways depending on the beginning fo your input :

Beginning of input Completion list Pattern(s)
./ files and subdirs in current directory single
../ files and subdirs in parent directory single
/ files and subdirs in root directory single
~ or ~/ files and subdirs in home directory single
anything else current directory tree, recursive multi
⚠️ **GitHub.com Fallback** ⚠️