pub struct SnippetConfig {
pub id: String,
pub title: String,
pub content: String,
pub keybinding: Option<String>,
pub keybinding_enabled: bool,
pub folder: Option<String>,
pub enabled: bool,
pub description: Option<String>,
pub auto_execute: bool,
pub variables: HashMap<String, String>,
}Expand description
A text snippet that can be inserted into the terminal.
Snippets support variable substitution using (variable) syntax. Example: “echo ‘Today is (date)’” will replace (date) with the current date.
Fields§
§id: StringUnique identifier for the snippet
title: StringHuman-readable title for the snippet
content: StringThe text content to insert (may contain variables)
keybinding: Option<String>Optional keyboard shortcut to trigger the snippet (e.g., “Ctrl+Shift+D”)
keybinding_enabled: boolWhether the keybinding is enabled (default: true) If false, the keybinding won’t be registered even if keybinding is set
folder: Option<String>Optional folder/collection for organization (e.g., “Git”, “Docker”)
enabled: boolWhether this snippet is enabled
description: Option<String>Optional description of what the snippet does
auto_execute: boolWhether to automatically send Enter after inserting the snippet (default: false) If true, a newline character is appended to execute the command immediately
variables: HashMap<String, String>Custom variables defined for this snippet
Implementations§
Source§impl SnippetConfig
impl SnippetConfig
Sourcepub fn new(id: String, title: String, content: String) -> SnippetConfig
pub fn new(id: String, title: String, content: String) -> SnippetConfig
Create a new snippet with the given ID and title.
Sourcepub fn with_keybinding(self, keybinding: String) -> SnippetConfig
pub fn with_keybinding(self, keybinding: String) -> SnippetConfig
Add a keybinding to the snippet.
Sourcepub fn with_keybinding_disabled(self) -> SnippetConfig
pub fn with_keybinding_disabled(self) -> SnippetConfig
Disable the keybinding for this snippet.
Sourcepub fn with_folder(self, folder: String) -> SnippetConfig
pub fn with_folder(self, folder: String) -> SnippetConfig
Add a folder to the snippet.
Sourcepub fn with_variable(self, name: String, value: String) -> SnippetConfig
pub fn with_variable(self, name: String, value: String) -> SnippetConfig
Add a custom variable to the snippet.
Sourcepub fn with_auto_execute(self) -> SnippetConfig
pub fn with_auto_execute(self) -> SnippetConfig
Enable auto-execute (send Enter after inserting the snippet).
Trait Implementations§
Source§impl Clone for SnippetConfig
impl Clone for SnippetConfig
Source§fn clone(&self) -> SnippetConfig
fn clone(&self) -> SnippetConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SnippetConfig
impl Debug for SnippetConfig
Source§impl<'de> Deserialize<'de> for SnippetConfig
impl<'de> Deserialize<'de> for SnippetConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SnippetConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SnippetConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SnippetConfig
impl PartialEq for SnippetConfig
Source§impl Serialize for SnippetConfig
impl Serialize for SnippetConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for SnippetConfig
Auto Trait Implementations§
impl Freeze for SnippetConfig
impl RefUnwindSafe for SnippetConfig
impl Send for SnippetConfig
impl Sync for SnippetConfig
impl Unpin for SnippetConfig
impl UnsafeUnpin for SnippetConfig
impl UnwindSafe for SnippetConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more