snippetexpander(1)

1980-01-01

NAME

snippetexpander - Snippet Expander CLI

DESCRIPTION

Save your often used text snippets and then expand them whenever you type their abbreviation.

For example:- "ser`" expands to "Snippet Expander rules!"

SYNOPSIS

snippetexpander --start

snippetexpander --stop

snippetexpander --status

snippetexpander --autostart={on|off|status}

snippetexpander --autoexpand={on|off|status}

snippetexpander -e|--export filename

snippetexpander -i|--import filename [--force]

snippetexpander --version

snippetexpander -h|--help

snippetexpander help [-c|--command] command

snippetexpander add [-a|--abbreviation] abbreviation [-b|--body] body

snippetexpander autoexpand [--on|--off]

snippetexpander autostart [--on|--off]

snippetexpander copy [-u|--skip-last-used] [-a|--abbreviation] abbreviation

snippetexpander expand [-u|--skip-last-used] [-a|--abbreviation] abbreviation

snippetexpander export [[-f|--filename filename] | [filename]] [-v|--version int]

snippetexpander import [-f|--filename] filename [-u|--update]

snippetexpander list [-a|--abbreviation] [-b|--body] [-d|--delimiter delimiter] [-i|--id] [-l|--last-used] [-r|--recent] [[-s|--search string] | [string]]

snippetexpander ping [-r|--response response] [response]

snippetexpander remove [-a|--abbreviation] abbreviation

OPTIONS

--start

Start the daemon.

--stop

Stop the daemon.

--status

Get status of the daemon, exits with status 0 if running, 1 if not.

--autoexpand={on|off|status}

Turn auto expand of snippets, "on", "off", or show "status" of setting.

--autostart={on|off|status}

Turn auto start of Snippet Expander on login, "on", "off", or show "status" of setting.

-e, --export=filename

Export snippets to file.

-i, --import=filename

Import snippets from file, skips snippets where abbreviation already exists.

--force

If used in conjunction with import, existing snippets with same abbreviation are updated.

--version

Display version number.

-h, --help

Display help.

COMMANDS

help command

Display help for a given command.
-c, --command command Optional sub command to display help for if not given as positional argument.

add abbreviation body

Create a new snippet for a given abbreviation and body.
-a, --abbreviation abbreviation
Optional flag to specify the abbreviation for the new snippet if not using positional arguments.
-b, --body body
Optional flag to specify the body for the new snippet if not using positional arguments.

autoexpand

Control or get status for whether snippets should auto expand. Calling the autoexpand command without any flags returns whether autoexpander is "on" or "off".
--off
Turn off auto expand of snippets.
--on
Turn on auto expand of snippets.

autostart

Control or get status for whether daemon should auto start on login. Calling the autostart command without any flags returns whether autostart is "on" or "off".
--off
Turn off auto start of Snippet Expander on login.
--on
Turn on auto start of Snippet Expander on login.

copy abbreviation

Copy to the pasteboard the snippet's body with evaluated placeholders for the given abbreviation.
-a, --abbreviation abbreviation
Optional abbreviation for the snippet to be expanded and copied into the pasteboard if not given as a positional argument.
-u, --skip-last-used
Do not update last used date for the snippet.

expand abbreviation

Output the snippet's body with evaluated placeholders for the given abbreviation.
-a, --abbreviation abbreviation
Optional abbreviation for the snippet to be expanded if not given as a positional argument.
-u, --skip-last-used
Do not update last used date for the snippet.

export filename

Save snippets to a file.
-f, --filename filename
Optional filename to be created, if not using the default, or positional argument. If not used, the default of "snippets-YYYY-MM-DD.json" will be used, where YYYY is the current year, MM the current month (01-12), and DD the day of the current month.
-v, --version int
Optional legacy format version number. Currently, only 101 is supported, which is compatible with Snippet Pixie.

import filename

Import snippets from file.
-f, --filename filename
Optional filename to be imported if not given as a positional argument.
-u, --update
Update existing snippets with same abbreviation. If this flag is not used, if an imported abbreviation already exists, it will not be altered, and the version in the file will not be imported.

list search_string

Search and output a formatted list of snippets. All snippets will be output if no search string is supplied.
-a, --abbreviation
Include abbreviation field (on by default if no fields specified).
-b, --body
Include body field (on by default if no fields specified).
-d, --delimiter delimiter
Change the delimiter used to separate the displayed fields (default " ").
-i, --id
Include id field.
-l, --last-used
Include lastUsed datetime field.
-r, --recent
Order by most recently used.
-s, --search string
List snippets where abbreviation or body includes search string, if not given as positional argument.

ping response

Ping the daemon for expected response string. If no response string given, "pong" will be used by default.
-r, --response response
Optional response string to be returned, if not given as positional argument, or not using default "pong".

remove abbreviation

Delete a snippet.
-a, --abbreviation abbreviation
Optional abbreviation for the snippet to be removed if not given as positional argument.

NOTES

Abbreviations should be short, easy to remember and hard to trigger accidentally.

It helps if an abbreviation includes either a key word from the fully expanded text, or an initialization or acronym that is part of it.

For example, if you regularly wrote "Snippet Expander" 😉 you might use "se".

However, there are a lot of words that include the letter combination "se", (see https://www.wordfind.com/contains/se/), so there's a reasonably high chance that Snippet Expander would expand that abbreviation when you didn't want it to.

So instead it's common to add a "trigger character" to the end of the abbreviation. This is commonly a character that isn't found in normal sentences such as "`" or "~" that is easy to find on your keyboard. Often just appending a space is enough, or doubling up characters.

I personally use "`" (commonly known as grav or backtick) a lot as it's a single keystroke on my British layout keyboard just below my Escape key. So for me "se`" is a natural abbreviation for "Snippet Expander".

However, I could see using "se " or "se~" for the abbreviation.

If you do use a trailing space as your trigger character you might find it useful to include a trailing space in the text that is expanded, e.g. "se " expands to "Snippet Expander " as it's more natural when typing.

LIMITATIONS

  • The cursor placeholder is not supported when using the CLI rather than auto-expansion.

SEE ALSO

snippetexpanderd(1) snippetexpanderx(1) snippetexpandergui(1) snippetexpander-placeholders(5)

AUTHORS

Created and maintained by Ian Jones <ian@ianmjones.com>. Up-to-date sources can be found at https://git.sr.ht/~ianmjones/snippetexpander. Information on how to contribute and where bug reports and feature requests may be submitted can be found on the project page at https://snippetexpander.org.