LinuxCommandLibrary

espanso

Expand text snippets with keywords automatically

TLDR

Check status

$ espanso status
copy

Edit the configuration
$ espanso edit config
copy

Install a package from the hub store ()
$ espanso install [package]
copy

Restart (required after installing a package, useful in case of failure)
$ espanso restart
copy

SYNOPSIS

espanso [GLOBAL_OPTIONS] <COMMAND> [COMMAND_OPTIONS]

PARAMETERS

--help, -h
    Prints help information for the main command or a specific subcommand.

--version, -V
    Prints the espanso version information.

--verbose, -v
    Enables verbose output for more detailed logs.

--config-dir <PATH>
    Specifies an alternative configuration directory for espanso.

--log-level <LEVEL>
    Sets the logging verbosity level (e.g., info, warn, error, debug, trace).

start
    Starts the espanso service. Use --unmanaged to start without managing the system service (e.g., systemd).

stop
    Stops the currently running espanso service.

restart
    Restarts the espanso service.

status
    Checks and prints the current status of the espanso service.

edit
    Opens the main espanso configuration file (default.yml) in your default text editor. Use --config <FILE> to open a specific configuration file.

log
    Displays the espanso service logs. Use --follow or -f to continuously output new log entries.

doctor
    Runs a diagnostic check to identify common installation or configuration issues and suggests fixes.

install
    Installs the espanso service to start automatically on boot (e.g., using systemd on Linux). On Wayland, consider using --no-hook to skip X11 hooks.

uninstall
    Removes the espanso service from automatic startup.

DESCRIPTION

Espanso is a powerful, cross-platform text expander written in Rust. It allows users to define custom "triggers" (short character sequences) that, when typed, are automatically replaced with predefined "snippets" of text. This significantly boosts productivity by automating repetitive typing tasks, correcting common typos, or inserting frequently used phrases, code blocks, or even dynamic content.

Espanso operates as a background service, monitoring keyboard input across nearly all applications. Its configuration is managed through simple YAML files, making it highly customizable and easy to share. Beyond static text replacement, espanso supports advanced features like shell command execution, scripting, date/time insertion, and form filling, enabling complex automation workflows directly from your keyboard. It's a versatile tool for developers, writers, and anyone looking to streamline their typing experience on Linux, macOS, and Windows.

CAVEATS

While espanso offers powerful text expansion, some caveats exist:
Wayland Support: Native Wayland support is evolving. On Wayland compositions, it often relies on XWayland or requires additional hooks/setups, and full functionality might vary. The --no-hook option during installation can be relevant here.
Security: As espanso can execute shell commands and scripts, users should exercise caution when importing configurations from untrusted sources, as malicious snippets could pose a security risk.
Application Compatibility: Although generally robust, some applications (especially those with custom input methods or strict security policies) might exhibit minor compatibility issues with text injection.

CONFIGURATION FILES

Espanso's behavior is defined through YAML configuration files. The main configuration is typically located at ~/.config/espanso/default.yml (or %APPDATA%\espanso on Windows). Snippets, referred to as 'matches', can be organized across multiple YAML files within the match/ subdirectory, allowing for modular and shared configurations.

DYNAMIC CONTENT AND ADVANCED FEATURES

Beyond simple text replacement, espanso supports a rich set of advanced features:
Forms: Create interactive prompts to gather user input directly within the snippet.
Shell Commands: Execute arbitrary shell commands and insert their output into the text.
Date/Time: Insert current dates and times with extensive formatting options.
Scripts: Integrate with scripting languages (e.g., Python, Javascript) for complex logic and dynamic content generation.
Extensions: Community-driven extensions provide specialized functionalities and integrations with other tools.

HISTORY

Espanso was created by Riccardo Padovani and first publicly released around 2019. Written in Rust, it quickly gained traction as a robust, cross-platform text expander, distinguishing itself from older, platform-specific alternatives. Its development has focused on reliability, security, and extensibility, introducing features like shell commands, forms, and custom extensions, evolving into a versatile automation tool beyond simple text replacement.

SEE ALSO

autokey, xdotool(1), xclip(1), bash(1)

Copied to clipboard