McFly 项目安装与使用指南
mcfly Fly through your shell history. Great Scott! 项目地址: https://gitcode.com/gh_mirrors/mc/mcfly
1. 项目目录结构及介绍
McFly 项目的目录结构如下:
mcfly/
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.txt
├── LICENSE
├── README.md
├── dev.bash
├── dev.fish
├── dev.zsh
├── mcfly.bash
├── mcfly.fish
├── mcfly.ps1
├── mcfly.zsh
├── src/
│ ├── main.rs
│ └── ...
├── pkg/
│ └── ...
├── docs/
│ └── ...
├── github/
│ └── workflows/
│ └── ...
└── HomebrewFormula/
└── ...
目录结构介绍
- Cargo.lock 和 Cargo.toml: Rust 项目的依赖管理文件。
- CHANGELOG.txt: 项目更新日志。
- LICENSE: 项目许可证文件。
- README.md: 项目介绍和使用说明。
- dev.bash, dev.fish, dev.zsh: 开发环境配置脚本。
- mcfly.bash, mcfly.fish, mcfly.ps1, mcfly.zsh: McFly 在不同 shell 中的初始化脚本。
- src/: 项目源代码目录,包含 Rust 源文件。
- pkg/: 打包相关文件。
- docs/: 项目文档。
- github/workflows/: GitHub Actions 工作流配置文件。
- HomebrewFormula/: Homebrew 安装配方文件。
2. 项目启动文件介绍
McFly 的启动文件主要包括以下几个:
- mcfly.bash: 用于 Bash shell 的启动脚本。
- mcfly.fish: 用于 Fish shell 的启动脚本。
- mcfly.ps1: 用于 PowerShell 的启动脚本。
- mcfly.zsh: 用于 Zsh shell 的启动脚本。
这些启动文件的作用是在相应的 shell 中初始化 McFly,使其能够替换默认的 ctrl-r
历史搜索功能。
启动文件使用方法
在相应的 shell 配置文件(如 .bashrc
, .zshrc
, .config/fish/config.fish
)中添加以下内容:
-
Bash:
eval "$(mcfly init bash)"
-
Zsh:
eval "$(mcfly init zsh)"
-
Fish:
mcfly init fish | source
-
PowerShell:
Invoke-Expression -Command $(mcfly init powershell | out-string)
3. 项目配置文件介绍
McFly 的配置主要通过环境变量进行。以下是一些常用的配置项:
3.1 颜色模式设置
-
Light Mode: 在浅色终端中使用 McFly 时,可以设置
MCFLY_LIGHT
环境变量为TRUE
。-
Bash/Zsh:
export MCFLY_LIGHT=TRUE
-
Fish:
set -gx MCFLY_LIGHT TRUE
-
PowerShell:
$env:MCFLY_LIGHT = "TRUE"
-
3.2 其他配置项
McFly 还支持其他一些环境变量配置,具体可以参考项目的 README.md
文件。
总结
通过以上步骤,您可以成功安装并配置 McFly,使其在您的 shell 中提供智能的历史命令搜索功能。希望本指南对您有所帮助!
mcfly Fly through your shell history. Great Scott! 项目地址: https://gitcode.com/gh_mirrors/mc/mcfly