{"id":20637125,"url":"https://github.com/barbuk/snippy","last_synced_at":"2026-04-18T20:06:01.314Z","repository":{"id":77107799,"uuid":"273426353","full_name":"BarbUk/snippy","owner":"BarbUk","description":"Snippet manager with rofi and fzf","archived":false,"fork":false,"pushed_at":"2024-03-18T05:54:07.000Z","size":134,"stargazers_count":21,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T01:51:42.521Z","etag":null,"topics":["bash","cli","clipboard","fzf","linux","rofi","snippet"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BarbUk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-19T06:58:24.000Z","updated_at":"2025-01-11T22:59:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"4129b271-7dba-4839-b42d-148393dc36b5","html_url":"https://github.com/BarbUk/snippy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarbUk%2Fsnippy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarbUk%2Fsnippy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarbUk%2Fsnippy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarbUk%2Fsnippy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BarbUk","download_url":"https://codeload.github.com/BarbUk/snippy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249161104,"owners_count":21222468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cli","clipboard","fzf","linux","rofi","snippet"],"created_at":"2024-11-16T15:13:09.568Z","updated_at":"2026-04-18T20:06:01.307Z","avatar_url":"https://github.com/BarbUk.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snippy\n\nA powerful Linux snippet manager for enhanced productivity and workflow automation.\n\n![snippy](img/snippy.png)\n\n## Overview\n\nSnippy is a versatile command-line snippet manager that seamlessly integrates with your desktop environment to provide quick access to frequently used text snippets, commands, and templates.\n\n\u003cdetails\u003e\n\u003csummary\u003eTable of Contents\u003c/summary\u003e\n\n## Table of Contents\n\n- [Installation](#installation)\n  - [Arch Linux](#arch-linux)\n  - [Manual Installation](#manual-installation)\n  - [Prerequisites](#prerequisites)\n  - [Initial Setup](#initial-setup)\n- [Features](#features)\n  - [Intelligent Clipboard Management](#intelligent-clipboard-management)\n  - [Smart Cursor Positioning](#smart-cursor-positioning)\n  - [Dynamic Content Processing](#dynamic-content-processing)\n  - [Snippet Headers](#snippet-headers)\n  - [Visual Organization](#visual-organization)\n- [Usage](#usage)\n  - [Command Line Interface](#command-line-interface)\n  - [Examples](#examples)\n  - [Bash Completion](#bash-completion)\n- [Creating Snippets](#creating-snippets)\n  - [Basic Snippet](#basic-snippet)\n  - [Snippet with Variables](#snippet-with-variables)\n  - [Snippet with Placeholders](#snippet-with-placeholders)\n  - [Executable Snippet](#executable-snippet)\n  - [Script Snippet](#script-snippet)\n  - [No-Parse Snippet](#no-parse-snippet)\n  - [Rich Snippet (HTML)](#rich-snippet-html)\n- [Keyboard Shortcuts](#keyboard-shortcuts)\n- [Platform Support](#platform-support)\n  - [Display Servers](#display-servers)\n  - [Desktop Environments](#desktop-environments)\n- [Configuration](#configuration)\n  - [Environment Variables](#environment-variables)\n  - [Snippet Location](#snippet-location)\n- [Contributing](#contributing)\n- [License](#license)\n- [Acknowledgments](#acknowledgments)\n\u003c/details\u003e\n\n## Installation\n\n### Arch Linux\n\n[![snippy on AUR](https://img.shields.io/aur/version/snippy-snippet?label=snippy-snippet)](https://aur.archlinux.org/packages/snippy-snippet/)\n\nSnippy is available in the [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository) as [snippy-snippet](https://aur.archlinux.org/packages/snippy-snippet/).\n\nInstall using your preferred [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers):\n\n```bash\nyay -S snippy-snippet\n```\n\n### Manual Installation\n\n**For local user installation:**\n\n```bash\ncurl -fsSL https://github.com/barbuk/snippy/releases/latest/download/snippy \\\n  --create-dirs --output ~/.bin/snippy\nchmod +x ~/.bin/snippy\n```\n\nEnsure `~/.bin` is in your `PATH`.\n\n**For system-wide installation:**\n\n```bash\nsudo curl -fsSL https://github.com/barbuk/snippy/releases/latest/download/snippy \\\n  --output /usr/bin/snippy\nsudo chmod +x /usr/bin/snippy\n```\n\n### Initial Setup\n\nOn first run, Snippy will automatically create the configuration directory at `~/.config/snippy` with a sample snippet.\n\n\u003cdetails\u003e\n\u003csummary\u003ePrerequisites\u003c/summary\u003e\n\n### Prerequisites\n\nSnippy requires the following dependencies to be installed:\n\n**Core dependencies:**\n\n- `rofi` - Application launcher and menu\n- `fzf` - Command-line fuzzy finder\n- `jq` - JSON processor\n- `gettext` - Required for `envsubst` (variable expansion)\n\n**For X11:**\n\n- `xsel` - Command-line clipboard utility\n- `xclip` - Clipboard interface\n- `xdotool` - X11 automation tool\n\n**For Wayland:**\n\n- `wtype` - Text input automation\n- `wl-clipboard` (`wl-copy` and `wl-paste`)\n\n**Optional (for enhanced features):**\n\n- `bat` or `highlight` - Syntax highlighting in preview\n- `perl` - Required for certain text processing features\n\u003c/details\u003e\n\n### Debian / Ubuntu\n\n```bash\n# Base deps\nsudo apt install rofi fzf jq gettext-base perl\n\n# For wayland\nsudo apt install wtype wl-clipboard\n\n# For X11\nsudo apt install xsel xclip xdotool\n```\n\n### Fedora\n\n```bash\n# Base deps\nsudo dnf install rofi fzf jq gettext perl\n\n# For wayland\nsudo dnf install wtype wl-clipboard\n\n# For X11\nsudo dnf install xsel xclip xdotool\n```\n\n### Archlinux\n\n```bash\n# Base deps\nsudo pacman -Sy rofi fzf jq gettext perl\n\n# For wayland\nsudo pacman -Sy wtype wl-clipboard\n\n# For X11\nsudo pacman -Sy xsel xclip xdotool\n```\n\n## Features\n\n### Intelligent Clipboard Management\n\nSnippy provides advanced clipboard handling that preserves your workflow:\n\n- **Automatic clipboard restoration** - Your original clipboard content is automatically restored after pasting a snippet\n- **Dynamic clipboard integration** - Use `{clipboard}` placeholder to embed current clipboard content into snippets\n\n\u003csub\u003e`~/.config/snippy/create\\ database`\u003c/sub\u003e\n\n```mysql\nCREATE DATABASE `{clipboard}` CHARACTER SET utf8 COLLATE utf8_general_ci;\n```\n\n- **URL-encoded clipboard** - Use `{clipboard_urlencode}` for web-safe clipboard content\n\n\u003csub\u003e`~/.config/snippy/cached\\ url`\u003c/sub\u003e\n\n```text\nhttps://cachedview.nl/#{clipboard_urlencode}\n```\n\n### Smart Cursor Positioning\n\nControl exactly where the cursor lands after snippet insertion using the `{cursor}` placeholder:\n\n**Single-line positioning:**\n\n\u003csub\u003e`~/.config/snippy/pre`\u003c/sub\u003e\n\n```html\n\u003cpre\u003e{cursor}\u003c/pre\u003e\n```\n\n**Multi-line positioning:**\n\n\u003csub\u003e`~/.config/snippy/pre\\ multiline`\u003c/sub\u003e\n\n```html\n\u003cpre\u003e\n  {cursor}\n\u003c/pre\u003e\n```\n\nSnippy intelligently handles cursor movement in both CLI and GUI contexts, including special support for Vim.\n\n### Dynamic Content Processing\n\n**Variable expansion:**\nSnippy processes snippets through a bash-like template engine, allowing you to use variables and command substitution:\n\n\u003csub\u003e`~/.config/snippy/date\\ and\\ user`\u003c/sub\u003e\n\n```bash\nCurrent date: $(date +%Y-%m-%d)\nUsername: $USER\n```\n\n**Command execution:**\nSnippets starting with `$` are executed as commands, and their output is pasted:\n\n\u003csub\u003e`~/.config/snippy/date`\u003c/sub\u003e\n\n```bash\n$(date +%Y-%m-%d-%Hh%Mm%S)\n```\n\n**Script execution:**\nBash scripts stored in `$snippets_directory/scripts` are automatically executed when selected.\n\n**Raw content mode:**\nUse `Ctrl+Return` to paste the snippet source code instead of its processed output.\n\n### Snippet Headers\n\nControl snippet behavior with special headers:\n\n- `##noparse` - Disable variable expansion and command execution\n\n- `##bash` - Enable full Bash expansion (variables and command substitution). **Use only for trusted snippets.**\n\n\u003csub\u003e`~/.config/snippy/cmd\\ last\\ month`\u003c/sub\u003e\n\n```bash\n##noparse\ndate --date=\"$(date +%F) -1 month\" +%F\n```\n\n- `##tmpfile` - Create a tempfile accessible via `$tmpfile` variable\n\n\u003csub\u003e`~/.config/snippy/test\\ tmpfile`\u003c/sub\u003e\n\n```bash\n##tmpfile\n$(xsel -b \u003e $tmpfile; cat $tmpfile)\n```\n\n- `##richsnippet` - Enable HTML clipboard support for rich text pasting\n\n\u003csub\u003e`~/.config/snippy/test\\ html`\u003c/sub\u003e\n\n```bash\n##richsnippet\n\u003cstrong\u003eshould be pasted as strong\u003c/strong\u003e\n```\n\n### Visual Organization\n\nOrganize your snippets with directory-based categorization. The top-level directory name is used as an icon identifier in rofi:\n\n```text\nterminal/\n├── commands/\n│   └── date\n└── scripts/\n    └── backup\n```\n\n![icons](img/icons.png)\n\n## Usage\n\n### Command Line Interface\n\n```bash\n/usr/bin/snippy-snippet 1.0.11\n\nUsage:\n  /usr/bin/snippy-snippet [OPTION] ACTION\n  Snippy snippets manager\n\nSnippet location\n  ~/.config/snippy\n\nOptions\n  -h, --help \t\tShow help\n  -s, --sort true|false Sort snippet in rofi\n  -m, --sorting-method \tfzf (default) or levenshtein\n\nActions\n  gui \t\tBrowse snippet and paste it in the focused window (default)\n  cli \t\tlist snippet in cli mode, only copy snippet in the paste buffer\n  rofi \t\tlist snippet in cli mode for rofi input. Accept an argument with the chosen snippet to paste it.\n  edit \t\tBrowse snippet and edit it\n  add \u003cname\u003e \tAdd a new snippet\n  list \t\tlist snippet\n  cat \t\tlist category\n  completion \tbash completion. Use it with: eval \"$(snippy completion)\"\n```\n\n### Examples\n\n**Browse and paste snippets (GUI mode):**\n\n```bash\nsnippy\n# or explicitly\nsnippy gui\n```\n\n**Use it directly inside rofi:**\n\nIf you already have a keybinding for rofi, you can add snippy as a mod:\n\n```bash\nrofi -theme-str 'element-icon { size: 3ch;}' -combi-modi 'snippets:snippy rofi' -show combi -modi combi\n```\n\n**Browse snippets in terminal:**\n\n```bash\nsnippy cli\n```\n\n**Create a new snippet:**\n\n```bash\nsnippy add database/mysql-create\n```\n\n**Edit an existing snippet:**\n\n```bash\nsnippy edit\n```\n\n**List all snippets:**\n\n```bash\nsnippy list\n```\n\n### Bash Completion\n\nEnable tab completion for Snippy commands and options by adding this line to your `~/.bashrc`:\n\n```bash\neval \"$(snippy completion)\"\n```\n\n## Creating Snippets\n\nSnippets are stored as plain text files in `~/.config/snippy`. The directory structure you create becomes your snippet organization system.\n\n### Basic Snippet\n\nCreate a file with your desired content:\n\n```bash\nmkdir -p ~/.config/snippy/greetings\necho \"Hello from Snippy!\" \u003e ~/.config/snippy/greetings/hello\n```\n\n### Snippet with Variables\n\nUse bash variable expansion and command substitution:\n\n```bash\nmkdir -p ~/.config/snippy/dates\ncat \u003e ~/.config/snippy/dates/current-datetime \u003c\u003c 'EOF'\nCurrent date and time: $(date '+%Y-%m-%d %H:%M:%S')\nUser: $USER\nEOF\n```\n\n### Snippet with Placeholders\n\nUse Snippy's special placeholders:\n\n```bash\nmkdir -p ~/.config/snippy/sql\ncat \u003e ~/.config/snippy/sql/create-database \u003c\u003c 'EOF'\nCREATE DATABASE `{clipboard}`\nCHARACTER SET utf8mb4\nCOLLATE utf8mb4_unicode_ci;\n\nUSE `{clipboard}`;\n{cursor}\nEOF\n```\n\n### Executable Snippet\n\nCreate a snippet that executes a command:\n\n```bash\necho '$(date +%Y-%m-%d-%Hh%Mm%S)' \u003e ~/.config/snippy/dates/timestamp\n```\n\n### Script Snippet\n\nCreate an executable bash script in the `scripts` directory:\n\n```bash\nmkdir -p ~/.config/snippy/scripts\ncat \u003e ~/.config/snippy/scripts/system-info \u003c\u003c 'EOF'\n#!/bin/bash\necho \"System Information\"\necho \"==================\"\necho \"Hostname: $(hostname)\"\necho \"Kernel: $(uname -r)\"\necho \"Uptime: $(uptime -p)\"\nEOF\n```\n\n### No-Parse Snippet\n\nPrevent processing of special characters:\n\n```bash\ncat \u003e ~/.config/snippy/examples/raw \u003c\u003c 'EOF'\n##noparse\nThis will be pasted as-is: $(date) $USER {cursor} {clipboard}\nEOF\n```\n\n### Rich Snippet (HTML)\n\nEnable HTML clipboard support:\n\n```bash\ncat \u003e ~/.config/snippy/html/bold-text \u003c\u003c 'EOF'\n##richsnippet\n\u003cstrong\u003e{clipboard}\u003c/strong\u003e\nEOF\n```\n\n## Keyboard Shortcuts\n\nWhen using the GUI mode with rofi:\n\n- **Enter** - Paste processed snippet (variables expanded, commands executed)\n- **Ctrl+Return** - Paste raw snippet content without processing\n- **Escape** - Cancel snippet selection\n\n## Platform Support\n\n### Display Servers\n\n- **X11** - Full support with xdotool, xsel, and xclip\n- **Wayland** - Full support with wl-clipboard and wtype\n\n### Desktop Environments\n\nSnippy has been tested and works with:\n\n- **Wayland compositors:**\n\n  - Sway\n  - Hyprland\n  - Niri\n\n- **X11 window managers:**\n\n  - All X11 window managers should be supported\n\n## Configuration\n\nSnippy uses a convention-over-configuration approach. Most behavior is controlled through snippet headers and directory structure rather than configuration files.\n\n### Environment Variables\n\n- `XDG_CONFIG_HOME` - If set, snippets are stored in `$XDG_CONFIG_HOME/snippy`\n- `EDITOR` - Used for editing snippets (defaults to `vim`)\n\n### Snippet Location\n\nDefault: `~/.config/snippy`\n\nYou can organize snippets in subdirectories. The top-level directory name is used as the icon identifier in rofi.\n\n## Contributing\n\nContributions are welcome! Here are ways you can help:\n\n- Report bugs and request features via [GitHub Issues](https://github.com/barbuk/snippy/issues)\n- Submit pull requests for bug fixes and enhancements\n- Improve documentation\n- Share your snippet collections and use cases\n\n## License\n\nSnippy is licensed under the [GNU General Public License v3.0](LICENSE).\n\n## Acknowledgments\n\nSnippy builds upon the work of several contributors:\n\n- **barbuk** - Current maintainer ([GitHub](https://github.com/barbuk))\n- **opennomad** - Major enhancements ([Gist](https://gist.github.com/opennomad/15c4d624dce99066a82d))\n- **mhwombat** - Original concept ([Arch Linux Forums](https://bbs.archlinux.org/viewtopic.php?id=71938\u0026p=2))\n- **sessy** - Initial implementation ([Arch Linux Forums](https://bbs.archlinux.org/viewtopic.php?id=71938))\n\nSpecial thanks to the open-source community for the excellent tools that make Snippy possible: rofi, fzf, and all the clipboard and automation utilities.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarbuk%2Fsnippy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarbuk%2Fsnippy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarbuk%2Fsnippy/lists"}