13个版本

使用旧的Rust 2015

0.1.75 2019年7月2日
0.1.74 2019年3月1日
0.1.72 2019年1月30日
0.1.6 2018年11月8日
0.1.0 2018年6月12日

文本处理中排名第758

每月下载量30

MITLGPL-3.0-or-later

25KB
587

Build Status

Рusty-x

一个简单的片段管理器,可以通过彩色终端输出查找您的片段。

片段可以按照以下示例设置

vim,
========    
# Splits                                                                                    
  * To balance splits, use Ctrl+w = 

在上面的示例中,我们看到第一行是关键词的数量,它们用逗号(,)字符分隔。等号(========)行是可选的,可以用来创建拆分。然后使用Markdown来描述内容。

注意事项

  • 警告:目前仅在posix平台上工作。所以目前还没有Windows版本。
  • 使用$EDITOR环境变量来选择您的编辑器。

安装

  1. 安装时,请确保已安装cargorust
  2. 使用cargo rusty-x --force安装,如果二进制文件已存在,则需要--force

当使用cargo安装时,命令以x开头。这意味着,例如。

x --edit python file

使用关键字python和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)

列出所有片段,当安装时,用cargo run替换为简单的x

cargo run

根据标签查找特定文件

cargo run <KEYWORDS>

添加带有关键字行和给定文件名的片段

cargo run --  --add=foo.md <KEYWORDS>

通过在给定的片段位置打开您的$EDITOR来添加片段

cargo run -- --new

使用给定关键词编辑片段

cargo run -- --edit <KEYWORDS>

同步并从您的片段仓库中提取片段

cargo run -- --pull

将片段保存到您的仓库中

cargo run -- --save

上面的命令会要求输入提交信息,如果需要的话,并始终尝试推送。

配置

默认代码片段的位置是 ~/.snippets/

默认创建一个 TOML 配置文件,位于: ~/.rusty-x.toml 默认配置将自动添加到配置文件中,以更改位置或编辑 toml。

以下是一个默认的 toml 文件,可以添加多个源,这些源将由 rusty-x 搜索

[[locations]]
local = "/home/tdejager/.snippets"
ext = "md"


[[locations]]
local = "/home/tdejager/.snippets-sjoerd"
ext = "md"

变更日志

0.72:添加了 pprint 库用于打印 0.73:按匹配标签的数量排序代码片段 0.74:现在移除了 rayon 依赖 0.75:更新了 skim 依赖

依赖项

~31–41MB
~710K SLoC