6.4 KiB
安装
curl -sL get.fisherman.sh | fish
使用
安装fishery插件。
fisher i fishtape shark get bobthefish
安装Oh My Fish插件。
fisher i omf/plugin-{percol,jump,fasd}
安装本地插件。
fisher i ./path/to/plugin
从不同的远程地址安装插件。
fisher i https://github.com/some/plugin another/plugin bb:one/more
从Gist安装插件。
fisher i gist.github.com/owner/1f40e1c6e0551b2666b2
更新一切。
fisher u
更新插件。
fisher u shark get
卸载插件。
fisher uninstall fishtape debug
显示和搜索
fisher list
命令会显示本地安装的插件。fisher search
命令会通过本地索引去查找合适的插件。
fisher list
debug
fishtape
spin
> superman
@ wipe
查找索引。
fisher search
...
* debug Conditional debug logger
errno POSIX error code/string translator
* fishtape TAP producing test runner
flash Flash-inspired, thunder prompt
fzf Efficient keybindings for fzf
get Press any key to continue
...
> superman Powerline prompt based on Superman
...
使用正则表达式查找索引。
fisher search --name~/git-is/
git-is-dirty Test if there are changes not staged for commit
git-is-empty Test if a repository is empty
git-is-repo Test if the current directory is a Git repo
git-is-staged Test if there are changes staged for commit
git-is-stashed Test if there are changes in the stash
git-is-touched Test if there are changes in the working tree
使用标签查找索引。
fisher search --tag={git,test}
...
* fishtape TAP producing test runner
git-branch-name Get the name of the current Git branch
git-is-dirty Test if there are changes not staged for commit
git-is-empty Test if a repository is empty
git-is-repo Test if the current directory is a Git repo
git-is-staged Test if there are changes staged for commit
git-is-stashed Test if there are changes in the stash
git-is-touched Test if there are changes in the working tree
...
最前面的符号由下面组成:
>
该插件是用于修改提示符*
该插件已安装@
该插件是一个本地软链接
管道
Fisherman 的命令全部支持管道。用管道连接另一个命令可以实现更复杂的功能。
更新所有为软链接的插件。
fisher list --link | fisher update -
开启当前被禁止的插件。
fisher list --disabled | fisher install
卸载所有的插件,并从缓存中删除。
fisher list | fisher uninstall --force
Dotfiles
当你安装插件时,Fisherman 会更新 fishfile 以便之后维护插件。
- 自定义 fishfile 的位置。
set -g fisher_file ~/.dotfiles/fishfile
扁平化的目录结构
Fisherman 会合并所有插件的目录到一个扁平的目录结构。因为这样在 shell 启动时,即便再多的插件,也只用加载一次,性能都表现良好。
下面的图例展现了一个插件在 Fiserhman 的配置目录的架构。
$fisher_config
├── cache
├── completions
│ └── my_plugin.fish
├── conf.d
│ └── my_plugin.fish
├── fishfile
├── functions
│ ├── fish_prompt.fish
│ ├── fish_right_prompt.fish
│ └── my_plugin.fish
└── man
└── man1
└── my_plugin.1
索引
索引就是一个记录了被 Fisherman 安装的官方插件的文本数据库。
索引记录了每个插件的名字, 地址, 信息,一个或多个标签和作者。
z
https://github.com/fishery/z
Pure-fish z directory jumping
z search cd jump
jethrokuan
如果你想要提交插件到这个索引, 你可以向我们发起一个 PR 到这个仓库
git clone https://github.com/fisherman/index
cd index
echo "$name\n$url\n$info\n$tags\n$author\n\n" >> index
git push origin master
变量
-
$fisher_home: Fisherman 的家目录。如果你按照推荐的方式安装了 Fisherman,这个位置应该就是 XDG_DATA_HOME/fisherman 。
-
$fisher_config: Fisherman 的配置目录。这个目录默认应该是你的 fishfile, key_bindings.fish, cache, functions, completions and conf.d 等目录的父目录。它的默认值是 XDG_CONFIG_HOME/fisherman 。
-
$fisher_file: 具体查看 fishfile 。
-
$fisher_cache: Fisherman 的缓存目录。 所有的插件都被下载在这个位置。
-
$fisher_alias command=alias ...: 可以使用这个变量去创建 Fisherman 的命令别名。