pub struct CommandHistorySource {
pub spec: PickerSourceSpec,
}Expand description
:picker history — also reached via the q: Normal chord and
the :history ex-command (MB.3). Walks ctx.command_history
(the App’s command-line history ring, stored oldest-first) and
emits one row per past command, newest first. <CR> loads
the chosen command into the editable : line via
RoutingPayload::LoadCommandLine — it does not execute;
the user tweaks (or <C-x><C-e> expands) then <CR>s. The
modern replacement for vim’s command-line window: fuzzy-filter
past commands instead of scrolling a scratch buffer
(docs/dev/architecture/rich-minibuffer.md §4).
The history ring already collapses consecutive duplicates at
push time, so no dedup here; non-adjacent repeats (:w … :w)
stay as distinct rows, matching vim’s :history.
Fields§
§spec: PickerSourceSpecImplementations§
Trait Implementations§
Source§impl Default for CommandHistorySource
impl Default for CommandHistorySource
Source§impl PickerSourceGenerator for CommandHistorySource
impl PickerSourceGenerator for CommandHistorySource
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
Generator metadata. Returned by reference so the
registry can stamp it into
:describe-picker /
:picker <Tab> listings without cloning.Source§fn init(
&self,
ctx: &PickerContext<'_>,
_args: &[String],
) -> SourceResult<PickerInitResult>
fn init( &self, ctx: &PickerContext<'_>, _args: &[String], ) -> SourceResult<PickerInitResult>
Build the candidate set. Sync prelude: read what’s
needed from
ctx, clone into async captures if
necessary, return the appropriate PickerInitResult
variant. Synchronous errors (no active buffer when
one was required, args validation failure) return
Err; the host echoes the error and leaves the
picker closed. Read moreSource§fn accept(
&self,
_ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> SourceResult<PickerAcceptOutcome>
fn accept( &self, _ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> SourceResult<PickerAcceptOutcome>
Translate the user’s chosen routing payload into a
typed
PickerAcceptOutcome the host applies. The
generator owns the mapping from its emitted
routing-payload variant(s) to outcome(s); mismatch
returns Err, which the host echoes.Source§fn accept_async(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<AcceptFuture>
fn accept_async( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<AcceptFuture>
Async-accept hook. Default
None means “this source resolves accept
synchronously” — every native source takes this path and is unchanged. Read moreSource§fn on_query_changed(
&self,
_ctx: &PickerContext<'_>,
_query: &str,
) -> Option<SourceResult<PickerInitResult>>
fn on_query_changed( &self, _ctx: &PickerContext<'_>, _query: &str, ) -> Option<SourceResult<PickerInitResult>>
Live-source hook: re-fetch candidates when the user’s
query changes. Default
None means “static source –
host uses fuzzy refilter over the candidate set
returned by init”. Returning Some(result) from a
source whose spec().live == true replaces the
picker’s candidate set wholesale; the host wires up
debouncing and cancels any in-flight invocation when a
fresh query arrives. Read moreSource§fn descend(
&self,
_ctx: &PickerContext<'_>,
_candidate: &RawCandidate,
) -> Option<String>
fn descend( &self, _ctx: &PickerContext<'_>, _candidate: &RawCandidate, ) -> Option<String>
PC.10:
<C-l> — refine the query from the selected candidate instead
of accepting it. Read morePP.3:
<CR> on a row that is a SIGNPOST rather than a destination. Read moreSource§fn initial_query(&self, _args: &[String]) -> Option<String>
fn initial_query(&self, _args: &[String]) -> Option<String>
PP.1: the query the picker opens WITH. Read more
Source§fn preview(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<PickerPreviewOutcome>
fn preview( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<PickerPreviewOutcome>
T.12: live-preview hook — invoked as the picker SELECTION moves to
a candidate (before accept). Default None = no preview. A source
returns an outcome the host applies immediately for a live preview;
the host restores prior state on . Read more
Source§fn preview_debounce(&self) -> Option<Duration>
fn preview_debounce(&self) -> Option<Duration>
Auto Trait Implementations§
impl Freeze for CommandHistorySource
impl RefUnwindSafe for CommandHistorySource
impl Send for CommandHistorySource
impl Sync for CommandHistorySource
impl Unpin for CommandHistorySource
impl UnsafeUnpin for CommandHistorySource
impl UnwindSafe for CommandHistorySource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more