I'm trying to write a plugin for the fish shell but can't get it to work.
I have the following in a file called functions/codex.fish
:
function create_completion
commandline -a test
end
bind \cx create_completion
I installed the plugin using 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
However when I try to run the function using Ctrl+x nothing happens.
What am I doing wrong?
I have the following in a file called functions/codex.fish:
There's your problem. Fish functions are lazily loaded. A file called "codex.fish" will be loaded once a function called "codex" is executed for the first time.
So those bindings will only be defined after you've run "codex" once in that session (unless there's another codex.fish that has precedence, in which case they won't be defined at all).
Simply add the binding to config.fish, or one of the eagerly loaded files in ~/.config/fish/conf.d
.