Crates.io | rsnip |
lib.rs | rsnip |
version | |
source | src |
created_at | 2025-01-05 11:04:59.317675 |
updated_at | 2025-01-08 21:11:23.874481 |
description | A universal command-line snippet manager |
homepage | |
repository | https://github.com/sysid/rsnip |
max_upload_size | |
id | 1504668 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
RSnip is a command-line text snippet manager built in Rust that helps you save and reuse frequently used text snippets with powerful templating capabilities.
cargo install rsnip
rsnip edit --ctype shell # Opens your default editor
--- greeting
Hello {{ env_USER }}!
---
--- backup
tar -czf backup-{{ current_date|strftime('%Y%m%d') }}.tar.gz ./
---
# List available snippets
rsnip list --ctype shell
# Copy a snippet to clipboard
rsnip copy --ctype shell --input greeting
# Interactive fuzzy search
rsnip complete --ctype shell --interactive
Add to your .bashrc
:
# Optional: Add convenient alias
alias ,="rsnip copy --ctype shell --input"
# Enable tab completion
source /path/to/rsnip.bash
Now you can use:
, back<tab> # Will fuzzy-find and complete 'backup'
RSnip looks for configuration in the following locations:
~/.config/rsnip/config.toml
~/.rsnip/config.toml
/etc/rsnip/config.toml
Example configuration:
[snippet_types.shell]
source_file = "~/.config/rsnip/shell_snippets.txt"
description = "Shell command snippets"
[snippet_types.git]
source_file = "~/.config/rsnip/git_snippets.txt"
description = "Git commands and workflows"
RSnip supports Jinja2-style templates with several built-in filters:
strftime
: Format dates - {{ current_date|strftime('%Y-%m-%d') }}
add_days
: Add days to date - {{ current_date|add_days(7) }}
subtract_days
: Subtract days - {{ current_date|subtract_days(7) }}
Environment variables are available as env_VARNAME
:
--- path
Current path is: {{ env_PATH }}
---
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
# Clone the repository
git clone https://github.com/yourusername/rsnip
cd rsnip
# Run tests
cargo test
# Build in release mode
cargo build --release
This project is licensed under the BSD 3 License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.