A simple snippet manager to find your snippets with colorized terminal output.
Snippets can be setup as the following example:
vim, ======== # Splits * To balance splits, use Ctrl+w =
Above we see that the first line is a number of keywords, which are delimited with an
, character. The line of
======== is optional, it can be used to create a split. Then markdown is used to describe the content.
- Warning currently only works on posix platforms. So now windows yet.
- Uses $EDITOR env var to select your editor.
- To install make sure that
- Install with
cargo rusty-x --force,
--forceis needed when the binary already exists
When installed from with cargo install, the commands start with
x. So that means, e.g.:
x --edit python file
To edit a snippet with the keywords python and file.
Usage: x x [--add=<filename>] <keywords>... x --new x [--edit] <keywords>... x --pull x --save Options: -h, --help Show this message --new Add a new snippet without a given name and you need to fill in the keywords --add=<filename> Add a new snippet with given filename and keywords -e, --edit Edit a existing snippet --pull Sync snippet repo (git pull) --save Save snippet repo (git add, git commit, git push)
To list all snippets, when installed replace all
cargo run with simply
To find specific files according to tags:
cargo run <KEYWORDS>
To add a snippet with a keyword line, and a given filename:
cargo run -- --add=foo.md <KEYWORDS>
To add a snippet by just opening your
$EDITOR at the given snippet location
cargo run -- --new
To edit a snippet with a given keywords:
cargo run -- --edit <KEYWORDS>
To sync and pull snippets from your snippet repo's:
cargo run -- --pull
To save snippets to your repositories:
cargo run -- --save
The command above aks for a commit message in case this is needed, and always tries to do a push for now.
The default snippet location is
A TOML is created as default configuration file, which can be found at:
A default config is added to the config file automatically to change the location edit the toml.
Below a default toml can be found, multiple sources can added which
[[locations]] local = "/home/tdejager/.snippets" ext = "md" [[locations]] local = "/home/tdejager/.snippets-sjoerd" ext = "md"