summaryrefslogtreecommitdiff
path: root/content/cool-emacs/input-completition-in-emacs.md
diff options
context:
space:
mode:
authorUser Mms <mms@voyager.local>2024-10-17 21:08:50 +0200
committerUser Mms <mms@voyager.local>2024-10-17 21:08:50 +0200
commit8fbff6319173bb19d2c74db70e4568fd08b01ee6 (patch)
tree58697a5b114fe41f83a49b8dd3bed3e885df1d43 /content/cool-emacs/input-completition-in-emacs.md
parent56a32cb861e698cbe633b037e4a9bc42dd7403c3 (diff)
tidy up
Diffstat (limited to 'content/cool-emacs/input-completition-in-emacs.md')
-rw-r--r--content/cool-emacs/input-completition-in-emacs.md121
1 files changed, 0 insertions, 121 deletions
diff --git a/content/cool-emacs/input-completition-in-emacs.md b/content/cool-emacs/input-completition-in-emacs.md
deleted file mode 100644
index 6b7387f7..00000000
--- a/content/cool-emacs/input-completition-in-emacs.md
+++ /dev/null
@@ -1,121 +0,0 @@
-+++
-title = "Input Completiton"
-author = ["MichaƂ Sapka"]
-date = 2023-05-26T23:00:00+02:00
-categories = ["emacs"]
-draft = false
-weight = 3004
-image_dir = "cool-emacs"
-image_max_width = 480
-primary_menu = "cool-emacs-appendix"
-abstract = "Icomplete, IDO and FIDO"
-aliases = ["/2023/input-completition-in-emacs/", "/emacs/input-completition-in-emacs/"]
-[menu]
- [menu.cool-emacs-appendix]
- weight = 3004
- identifier = "input-completiton"
-+++
-
-Emacs consists of a massive set of tools with a long history.
-Therefore, whatever the problem is, someone likely has already created a package for it.
-In many cases, this package is already baked in Emacs.
-This is great for veterans but very confusing to newcomers - like me.
-
-
-## The three modes {#the-three-modes}
-
-Emacs comes with three modes for input completion: Icomplete, IDO, and FIDO.
-Input completion works with whatever you select in the Minibuffer section.
-For text competition, you must use a different solution, like Company mode[^fn:1].
-
-The oldest one of those is _icomplete_[^fn:2] mode.
-It allows you to select from a list of choices incrementally[^fn:3], so you need to type the beginning, and icomplete will narrow the list of propositions.
-For example, when searching for "magit", the user needs to type "m" first as omitting it and starting with "i" will instead narrow to options beginning with "i".
-Similarly, "mgt" will not limit to "magit" as we're missing"a".
-Newer Emacs versions allowallow us to use "flex" matching with icomplete, but more on this later.
-Incomplete work for all lists using a mini buffer, like filenames or imenu.
-
-Then _IDO_[^fn:4] mode (Interactively Do) came in.
-It uses the aforementioned "flex" matching, where you can search for any part of the word.
-"Magit" would be found with "agit", "mgt" or just "git".
-IDO, however, works only with files and buffers, so \`M-x\` would still fall back to icomplete.
-
-Starting with Emacs 27, we've got _fido_ mode (Fake Ido).
-It combines the best things about icomplete (works anywhere) with flex matching.
-In fact, all Fido does under the hood is to enable Icomplete with flex matching.
-
-There are also other solutions for competition, not baked into emacs, with the most popular being Helm[^fn:5] and Ivy[^fn:6].
-Personally, I always try the default option, and only if their limits become annoying do I look at the alternatives.
-So, I am now a happy FIDO mode user.
-
-
-## Using FIDO {#using-fido}
-
-To start FIDO mode run
-
-```emacs-lisp
-fido-mode
-```
-
-or, if you find a vertical list to be more readable, use
-
-```emacs-lisp
-fido-veritcal-mode
-```
-
-You can also customize variables to have it auto-load in your \`init.el\`:
-
-```emacs-lisp
-(fido-mode t)
-;; or
-(fido-vertical-mode t)
-```
-
-As I've stated above, FIDO is nothing more than flex-enabled Icomplete, so all keybindings work the same.
-For vertical mode:
-
-- Typing a string will narrow the selection
-- \`C-n\` and \`C-p\` will select the next/prev element on the list
-- \`Tab\` will display a buffer with a list of narrowed elements
-- \`enter\` or \`C-j\` will select the option
-
-One cool thing you can do with FIDO is file deletion (when selecting files) or closing buffers (when selecting buffers) using \`C-k\`.
-
-
-## Customizing the Minibuffer {#customizing-the-minibuffer}
-
-We can, of course, customize how Icomplete looks works[^savanah].
-
-- _icompleteatches-format_ (default "%s/%s") - how the number of filtered and total options is presented
-- _complete-first-match_ (default (t :weight bold)) - how the first filtered option is presented
-- _icomplete-selected-match_ (default (t :inherit highlight)) - the same as above, but for vertical mode
-- _icomplete-section_ (default (t :inherit shadow :slant italic)) - how the section title for vertical mode is presented
-- _icomplete-compute-delay_ (default .15) - how fast the filtering will start after a keypress when a larger number of options is presented
-- _icomplete-delay-completions-threshold_ (default 400) - defines the "large number" for icomplete-compute-delay
-- _icomplete-max-delay-chars_ (default 2) - maximum number of initial characters before applying _icomplete-compute-delay_. I have no idea what it means, nor have I the knowledge of Elisp to dig into it.
-- _icomplete-in-buffer_ (default nil) - enables usage of Icomplete outside of the Minibuffer. I have not tested it.
-
-We can also use _icomplete-minibuffer-setup-hook_ hook if needed.
-[^savanah]: list based on [Icomplete source code](https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/icomplete.el)
-
-
-## Using Completions from Elisp {#using-completions-from-elisp}
-
-The great thing about FIDO is that it, like Icomplete, uses Minibuffer API[^fn:7], so you can simply:
-
-```emacs-lisp
-(completing-read
- "prompt: "
- '(("option1" 1) ("option" 2))
- nil t "default query")
-```
-
-[^fn:1]: [Company-mode website](https://company-mode.github.io/)
-[^fn:2]: [Icomplete documentation](https://www.gnu.org/software/emacs/manual/html_node/emacs/Icomplete.html)
-[^fn:3]: According to a [Reddit comment](https://www.reddit.com/r/emacs/comments/13szol7/comment/jltmaud/?utm_source=reddit&utm_medium=web2x&context=3) this behavior is relatively new.
- Until recently, Icompelete only showed the narrowed selection in a dedicated buffer, similar to using \`Tab-Tab\` now.
- The actual input was still up to the user to type in. Thanks for the tidbit
-[^fn:4]: [IDO documentation](https://www.gnu.org/software/emacs/manual/html_mono/ido.html)
-[^fn:5]: [Helm website](https://emacs-helm.github.io/helm/)
-[^fn:6]: [Ivy website](https://oremacs.com/swiper/)
-[^fn:7]: [Guide on Minibuffer completition](https://www.gnu.org/software/emacs/manual/html_node/elisp/Minibuffer-Completion.html)