|Number of watchers on Github||389|
|Number of open issues||22|
|Average time to close an issue||3 months|
|Main language||Emacs Lisp|
|Average time to merge a PR||11 days|
|Open pull requests||5+|
|Closed pull requests||5+|
|Last commit||over 1 year ago|
|Repo Created||over 6 years ago|
|Repo Last Updated||over 1 year ago|
|Organization / Author||lewang|
|Do you use flx? Leave a review!|
|View open issues (22)|
|View flx activity|
|View on github|
|Fresh, new opensource launches 🚀🚀🚀|
Trendy new open source projects in your inbox! View examples
This project is more than a year old now. Lots of bugs have been worked out.
It appears some people use it on a regular basis.
Just drop all
.el files somewhere on your
load-path. Here's an
example using the folder
(add-to-list 'load-path "~/emacs.d/vendor")
flx- matching engine
flx-ido- ido interface for flx
flx-ido will pull in
flx as a dependency.
If you're an Emacs 24 user or you have a recent version of
flx-ido from MELPA.
This version will always be up-to-date.
flx-ido is also available on the Marmalade
flx-ido is part of the
Emacs Prelude. If you're a Prelude
flx-ido is already properly configured and ready for
Users of Debian 9 or Ubuntu 16.04 or later may simply
The sorting algorithm is a balance between word beginnings (abbreviation) and contiguous matches (substring).
The longer the substring match, the higher it scores. This maps well to how we think about matching.
In general, it's better form queries with only lowercase characters so the sorting algorithm can do something smart.
For example, if you have these files:
If the search term was pre-mode, you might expect
prelude-mode.el to rank
higher. However because the substring match
re-mode is so long,
clojure-mode.el actually scores higher.
Here, using premode would give the expected order. Notice that the
- actually prevents the algorithm from helping you.
Flx always folds lowercase letters to match uppercase. However, you can use uppercase letters for force flx to only match uppercase.
This is similar to Emacs' case-folding. The difference is mixing in uppercase letters does not disable folding.
Matches within the basepath score higher.
Add this to your init file and flx match will be enabled for ido.
(require 'flx-ido) (ido-mode 1) (ido-everywhere 1) (flx-ido-mode 1) ;; disable ido faces to see flx highlights. (setq ido-enable-flex-matching t) (setq ido-use-faces nil)
If you don't want to use the
flx's highlights you can turn them off like this:
(setq flx-ido-use-faces nil)
flx-ido-threshold to change the collection size above which flx
will revert to flex matching.
As soon as the collection is narrowed below
flx-ido-threshold, flx will
kick in again.
As a point of reference for a 2.3 GHz quad-core i7 processor, a value of
10000 still provides a reasonable completion experience.
Helm is not supported yet. There is a demo showing how it could work, but I'm still working through how to integrate it into helm.
The Helm demo shows the score of the top 20 matches.
flx algorithm willingly sacrifices memory usage for speed.
For 10k file names, about 10 MB of memory will be used to speed up future matching. This memory is never released to keep the match speed fast.
So far with modern computers, this feels like a reasonable design decision.
It may change in future.
Emacs's garbage collector is fairly primitive stop the world type. GC time can contribute significantly to the run-time of computation that allocates and frees a lot of memory.
Consider the following example:
(defun uuid () (format "%08x-%08x-%08x-%08x" (random (expt 16 4)) (random (expt 16 4)) (random (expt 16 4)) (random (expt 16 4)))) (benchmark-run 1 (let ((cache (flx-make-filename-cache))) (dolist (i (number-sequence 0 10000)) (flx-process-cache (uuid) cache)))) ;;; (0.899678 9 0.33650300000000044)
This means that roughly 30% of time is spent just doing garbage-collection.
flx can benefit significantly from garbage collection tuning.
By default Emacs will initiate GC every 0.76 MB allocated (
== 800000). If we increase this to 20 MB (
gc-cons-threshold == 20000000)
(benchmark-run 1 (setq gc-cons-threshold 20000000) (let ((cache (flx-make-filename-cache))) (dolist (i (number-sequence 0 10000)) (flx-process-cache (uuid) cache)))) ;;; (0.62035 1 0.05461100000000041)
So if you have a modern machine, I encourage you to add the following:
(setq gc-cons-threshold 20000000)
to your init file.