Snippet Expander
Your little expandable text snippets helper, for Linux.
Auto Expand Snippets
Save your often used text snippets and then auto expand them whenever you type their abbreviation.
For example, you could have an abbreviation "ser`" that expands to "Snippet Expander rules! 🤘" when you type it 😃.
Search & Paste Window
Use the search and paste window if you can't remember your abbreviation, or happen to be using an application that does not allow auto expansion of snippets.
The most recently used snippets are shown first, with numeric quick select keys.
GUI & CLI
As well as the desktop application, you can use a fully featured command line interface to manage your snippets and settings.
Placeholders
In the body of a snippet you can use placeholders for date and time, with calculations and formatting, the clipboard, other snippets, and where the cursor should go after expansion.
Settings
You can control whether Snippet Expander starts when you log in, whether snippets should auto expand, how the Search & Paste window is opened and whether the search box is focused at first.
Import & Export
You can export your snippets as a backup, or to then import on another machine.
Install
Snippet Expander isn't available to install from most Linux distribution's yet, but there are a few ways you can get it.
- Solus: Install via eopkg on Solus
- Build & Install: Build and install from source
Solus
There is a snippetexpander package for Solus. You can install it via the GUI software center for your flavour of Solus, or via eopkg on the command line:
sudo eopkg install snippetexpander
Build & Install
Snippet Expander isn't available to install from most Linux distribution's yet, so you may need to build and install it yourself.
As long as you have all the dependencies installed, you could build and install Snippet Expander manually.
git clone https://git.sr.ht/~ianmjones/snippetexpander
cd snippetexpander
make
sudo make install
For Debian, the build time dependencies are as follows, the names might be slightly different on other distributions:
wails
golang-go
nodejs
npm
libx11-dev
libgtk-3-dev
libwebkit2gtk-4.1-dev
build-essential
pkg-config
valac
libatspi2.0-dev
libgee-0.8-dev
libglib2.0-dev
libibus-1.0-dev
scdoc
Wails is used to build Snippet Expander's GUI, and isn't as widely available as a package as the rest of the dependencies. To install it, just run the following command once you have Go installed.
go install github.com/wailsapp/wails/v2/cmd/wails@latest
export PATH="$PATH:$HOME/go/bin"
Runtime Dependencies
The daemon has the following runtime package dependencies:
xclip
wl-clipboard
xdotool
wtype
When using X Server for display, xclip is used for copying snippets into the clipboard, and xdotool is used to paste the snippet, e.g. when using the Search & Paste window.
When using Wayland for display, wcopy (from wl-clipboard) is used for copying snippets into the clipboard, and wtype is used to paste the snippet, e.g. when using the Search & Paste window.
Manuals
Please find below the manual pages that come bundled with Snippet Expander.
- snippetexpander: Snippet Expander CLI
- snippetexpander-placeholders: Placeholders that can be used in abbreviation bodies
- snippetexpanderd: Snippet Expander daemon
- snippetexpandergui: Snippet Expander desktop application
- snippetexpanderx: Snippet Expander auto expand daemon
snippetexpander(1)
2025-04-17
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 -v|--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 flag, existing snippets with same abbreviation are updated.
-v, --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.
snippetexpander-placeholders(5)
2025-04-17
NAME
snippetexpander-placeholders - placeholders that can be used in Snippet Expander abbreviation bodies
SYNTAX
All placeholders are delimited (wrapped) by $$, with the placeholder name starting with an @ symbol.
For example, today's date can be inserted with $$@date$$.
Some placeholders allow for extra arguments when : follows their name and that is followed by the argument. For example a format for a date, or the abbreviation for a snippet. Check the following descriptions for each placeholder for more details.
To use $$ in your snippet body, escape the second $ with a backslash like so: $\$.
@DATE & @TIME
Quick Examples:
- Today's date with system format: $$@date$$
- Today's date with custom format: $$@date:%Y-%m-%d %H:%M:%S$$
- Tomorrow's date with system format: $$@date@+1D$$
- Date 2 weeks from today with custom format: $$@date@+2W:%x$$
- Time 3 hours from now: $$@time@+3H$$
@time is an alias for @date, with one important difference, the default output if no format specified is the default time format (%X) rather than default date format (%x).
The optional format specified after : can take a format string as detailed in the GLib.DateTime.format function's docs, see https://valadoc.org/glib-2.0/GLib.DateTime.format.html.
The optional date calculation starts with an @ after the placeholder name, followed by a signed integer and unit. The unit types are as follows:
- Y: Years
- M: Months
- W: Weeks
- D: Days
- h: Hours
- m: Minutes
- s: Seconds
You can apply more than one date calculation, for example +2h+30m adds 2 hours and 30 minutes to the current time.
You can use both positive (+) and negative calculations, for example -3D takes 3 days from the current date.
@CLIPBOARD
When $$@clipboard$$ is part of a snippet's body, when its abbreviation is expanded the current text contents of the clipboard will replace the placeholder.
@SNIPPET
You can have up to three levels of embedded snippets with the @snippet placeholder.
The abbreviation for the snippet to be embedded is entered after :, for example $$@snippet:sigg;$$ expands the snippet with abbreviation sigg; in place of the placeholder.
@CURSOR
Adding $$@cursor$$ to a snippet's body will put the cursor in its place after expansion instead of at the end of the expanded text.
If $$@cursor$$ is entered more than once in a snippet's body or via snippet embedding, then the last occurrence of the cursor placeholder wins.
The @cursor placeholder does not work when using the shortcut to open the search and paste window rather than auto-expansion.
SEE ALSO
snippetexpander(1) snippetexpanderd(1) snippetexpanderx(1) snippetexpandergui(1)
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.
snippetexpanderd(1)
2025-04-17
NAME
snippetexpanderd - Snippet Expander daemon
DESCRIPTION
The snippetexpanderd daemon is the brains of Snippet Expander, and must be running for other components such as the snippetexpander CLI and snippetexpandergui desktop client applications to work.
The daemon manages the database of snippets, most settings, and performs many other background operations on behalf of the client applications.
SYNOPSIS
snippetexpanderd [{-d|--database} filename] [-v|--version] [-h|--help]
OPTIONS
-d, --database=filename
Optional database path relative to the XDG_DATA_HOME path (usually ~/.local/share/).
-v, --version
Display version number.
-h, --help
Display help.
NOTES
You probably don't want to manually run snippetexpanderd, it's best to start it via the snippetexpander CLI or snippetexpandergui desktop client applications.
By default snippetexpanderd saves snippets and settings to an SQLite database at ~/.local/share/snippetexpanderd/snippetexpanderd.db.
SEE ALSO
snippetexpander(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.
snippetexpandergui(1)
2025-04-17
NAME
snippetexpandergui - Snippet Expander desktop application
DESCRIPTION
Save your often used text snippets and then expand them whenever you type their abbreviation, or via the search and paste window.
For example:- "ser`" expands to "Snippet Expander rules!"
SYNOPSIS
snippetexpander [-s|--search-and-paste] [-v|--version] [-h|--help]
OPTIONS
If no options are given, the snippet management window is shown.
-s, --search-and-paste
Show Snippet Expander's quick search and paste window.
If possible, a default shortcut of Ctrl+` for using the search and replace window is installed on first run.
You should set or change this to your preferred shortcut via your operating system's settings UI or files.
-v, --version
Display version number and exit immediately without showing a window.
-h, --help
Display help and exit immediately without showing a window.
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
- Auto-expansion only works on accessible applications, use the shortcut to open the search and paste window for other applications such as browsers and Electron based apps.
- Auto-expansion does not work in terminals, but the shortcut method works with terminals that accept Ctrl+v for paste such as the elementary OS terminal. Holding Shift while selecting a snippet from the search and paste window usually pastes into a terminal too.
- The cursor placeholder is not supported when using the shortcut method rather than auto-expansion.
SEE ALSO
snippetexpander(1) snippetexpanderd(1) snippetexpanderx(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.
snippetexpanderx(1)
2025-04-17
NAME
snippetexpanderx - Snippet Expander auto expand daemon
DESCRIPTION
Save your often used text snippets and then expand them whenever you type their abbreviation.
For example:- "ser`" expands to "Snippet Expander rules!"
The auto expand daemon works with accessible applications to automatically expand snippets as you type their abbreviation.
SYNOPSIS
snippetexpander [--start] [--stop] [--status] [-v|--version] [-h|--help]
OPTIONS
If no options are given, the expander is started.
--start
Start the auto expand daemon.
--stop
Stop the auto expand daemon.
--status
Display status of the Snippet Expander auto expand daemon, exits with status 0 if running, 1 if not.
-v, --version
Display version number.
-h, --help
Display help.
NOTES
You probably don't want to manually run snippetexpanderx, it's best to start it via the snippetexpander CLI or snippetexpandergui desktop client applications.
LIMITATIONS
- Auto-expansion only works on accessible applications, use the shortcut to open the search and paste window for other applications such as browsers and Electron based apps.
- Auto-expansion does not work in terminals, but the shortcut method works with terminals that accept Ctrl+v for paste such as the elementary OS terminal. Holding Shift while selecting a snippet from the search and paste window usually pastes into a terminal too.
- The cursor placeholder is not supported when using the shortcut method rather than auto-expansion.
SEE ALSO
snippetexpander(1) snippetexpanderd(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.
Changelog
v1.1.0 - 2025-03-23
- Abbreviations that end with another abbreviation are now allowed
- Abbreviations in pasted text are no longer expanded
- Debian package no longer built for releases
- Switched back to MIT license
- Dependencies updated
v1.0.3 - 2024-07-15
- Enable build and install on Ubuntu 24.04 LTS
- Dependencies updated
v1.0.2 - 2024-03-28
- Fix copying snippet on Wayland
- Fix pasting snippet on Wayland (when using standards compliant compositor)
- Remove dependency on cgo and xtst
- Now depends on xclip and xdotool for X Server
- Now depends on wl-clipboard and wtype for Wayland
- Other dependencies updated
- Minor fixes to man pages
v1.0.1 - 2023-11-24
No changes from v1.0.0, fixes issue with go module references.
v1.0.0 - 2023-11-24
Initial release
1.0.0-beta.2 - 2023-11-13
Various small (mostly build related) fixes.
1.0.0-beta.1 - 2023-10-08
- Add manual pages
- Enable d-bus introspection for snippetexpanderd services
- Update dependencies
1.0.0-alpha.3 - 2023-09-27
- Update snippets in GUI and Expander when snippets are updated in daemon by any means.
- v101 export files are now able to be imported into Snippet Pixie.
1.0.0-alpha.2 - 2023-08-30
Minor fixups for GUI desktop file and site's icons.
1.0.0-alpha.1 - 2023-08-30
First alpha of Snippet Expander 1.0.0, a rewrite of Snippet Pixie.
There's still plenty of polish needed, but the basics are working:
- CLI for controlling daemons and managing snippets.
- Daemon that does most of the work, servicing requests from CLI, auto expander, and GUI.
- Auto expander daemon that works with accessible apps to expand snippets while you type.
- GUI for managing snippets, with Search & Paste mode for quick select and paste into non-accessible apps.
Snippet Pixie
Looking for Snippet Pixie, Snippet Expander's predecessor?