我正试图为鱼壳写一个插件,但没能让它正常工作。我在一个名为functions/codex.fish的文件中有以下内容
function create_completion
commandline -a test
end
bind \cx create_completion我使用fisher安装了这个插件
tom@desktop-20-3 ~/g/b/z/update_insert (main)> fisher install ~/git/codex.fish/
fisher install version 4.3.1
Installing /home/tom/git/codex.fish
/home/tom/.config/fish/functions/codex.fish
Updated 1 plugin/s但是,当我尝试使用Ctrl+x运行函数时,什么都不会发生。
我做错了什么?
发布于 2022-03-29 06:24:39
我在一个名为functions/codex.fish的文件中有以下内容:
这是你的问题。鱼的功能是懒洋洋的。名为"codex.fish“的文件将在第一次执行名为"codex”的函数时加载。
因此,只有在会话中运行"codex“一次之后才会定义这些绑定(除非有另一个具有优先级的codex.fish,在这种情况下根本不会定义它们)。
只需将绑定添加到config.fish或~/.config/fish/conf.d中一个急切加载的文件中即可。
发布于 2022-03-28 18:52:21
您不需要插件来设置键绑定。有一种方法可以做到:
function create_completion
commandline -a test
endfuncsave create_completion(这将创建文件~/.config/fish/functions/create_completion.fish;您也可以手动创建该文件。)
funced fish_user_key_bindings并添加绑定:function fish_user_key_bindings
bind \cx create_completion
end现在,control应该执行这个函数。
https://stackoverflow.com/questions/71646083
复制相似问题