[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Incrementally display the Emacs command list filtered o
From: |
Hongyi Zhao |
Subject: |
Re: [External] : Incrementally display the Emacs command list filtered out by the input key words in real-time. |
Date: |
Fri, 2 Jul 2021 23:40:03 +0800 |
On Fri, Jul 2, 2021 at 10:43 PM Drew Adams <drew.adams@oracle.com> wrote:
>
> > Say, when I input "foo bar", the matched command
> > list are incrementally displayed immediately, and
> > finally the ones which including "foo" and "bar"
> > in any part of the candidate commands are filtered
> > out. How do I configure my init file to implement
> > this feature?
>
> Not too sure what you're asking for.
>
> 1. You say you want to first see command-name
> matches for input `foo bar'.
> 2. But then you say you want command names that
> contain either `foo' or `bar' to be filtered
> out (i.e., excluded).
>
Sorry for my misleading/erroneous description. I mean 1. above-mentioned by you.
> Those two seem contradictory. The first seems
> unnecessary - undone by the second. But maybe
> you just want to see all command names at first,
> for some reason.
>
> Anyway, if what you want is instead something
> like this:
>
> 1. You see all command names initially.
> 2. You type something to exclude the names that
> contain either `foo' or `bar'.
>
> Then that's trivial if you use Icicles.
>
> 1. To see all completions initially, set or bind
> variable `icicle-show-Completions-initially-flag'
> to non-nil.
>
> 2. To exclude matches of some pattern (e.g. `foo'):
>
> a. Type the pattern, to see _only_ its matches.
> b. Use `C-~' to get the complement, i.e., to
> subtract those matches from the previous set
> of matches.
>
> E.g., to exclude all matches for `foo' or `bar'
> (anywhere in the command name, i.e., in any order):
>
> 1. Type `foo C-~' to see all except `foo' matches.
> 2. Type `bar C-~' to see all except matches for
> `foo' or `bar'.
>
> See also:
>
> * https://www.emacswiki.org/emacs/Icicles_-_Nutshell_View#ChippingAway
>
> * https://www.emacswiki.org/emacs/Icicles_-_Candidate_Sets#SetOperations
>
> If you don't really care to show all completions for
> empty input (e.g. all command names), then leave
> `icicle-show-Completions-initially-flag' nil.
>
> By default, you can just use `TAB' or `S-TAB' to
> initiate completion. Doing that once suffices:
> completions are then updated automatically as you
> change your minibuffer input.
>
> If you want completions to be updated automatically
> whenever you change minibuffer input without having
> to use `TAB' or `S-TAB', but you don't want to show
> completions initially (i.e., with empty input), then
> set variable `icicle-incremental-completion' to
> non-nil and non-t (the default value is `t').
>
> [You can cycle its value any time, using `C-#' during
> completion: OFF, ON (initiated by `TAB' or `S-TAB'),
> or eager (initiated by typing anything).]
>
> See:
> https://www.emacswiki.org/emacs/Icicles_-_Icompletion#IncrementalCompletion
>
> ___
>
> There is, BTW, no "fuzzy" matching involved in
> your example of excluding `foo' and `bar' matches.
> However, Icicles does support fuzzy matching -
> seven kinds of fuzzy matching, in fact.
>
> See
> https://www.emacswiki.org/emacs/Icicles_-_Completion_Methods_and_Styles#FuzzyCompletion
Thank you again for letting me know there are so many choices to
achieve this aim. Based on another hint/suggestion given by
Tassilo Horn <tsdh@gnu.org>, I'm currently using the following
settings to obtain this effect:
;;;
(straight-use-package
`(swiper :type git :host github :repo "abo-abo/swiper"
:pre-build (
;("bash" "-c" "cd ~/.emacs.d/straight/repos/swiper")
;https://github.com/abo-abo/swiper/issues/2886#issuecomment-860605327
("make" "deps")
("make" "compile")
)))
(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
;;;
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China