This plugin is under development and can have breaking changes in the future.
This plugin is to run a command for specific commands instead of showing regular completions of fish.
The next demo shows for the usage of kubectl get pods
with fzf for a completion by this plugin.
fzf
(Verifieid with a version >=0.54
)
Install this plugin using a fisher.
fisher install at-ishikawa/fish-completion-interceptor
If you try to use completion by a tab key, this plugin is used automatically for specific commands.
If you want to use other completions, define fish_completion_interceptor_fallback
function in your config file and call it.
For example, if you want to use jethrokuan/fzf as default, you can still use that plugin by defining the next function in ~/.config/fish/config.fish
.
function fish_completion_interceptor_fallback
__fzf_complete
end
There are some variables that can be defined:
FISH_COMPLETION_INTERCEPTOR_PLUGINS
: The commands to intercept by which function.FISH_COMPLETION_INTERCEPTOR_ENABLED
: true if the interceptor is enabled.FISH_COMPLETION_INTERCEPTOR_FZF_KEY_BINDINGS
: The options to run fzf. The default is--inline-info --layout reverse --preview-window down:70% --bind ctrl-k:kill-line,ctrl-alt-t:toggle-preview,ctrl-alt-n:preview-down,ctrl-alt-p:preview-up,ctrl-alt-v:preview-page-down
.
Currently, there are a few plugins supported by this plugin. Note that not all subcommands have been supported for each plugin.
- kubectl
- GitHub CLI
- gcloud
- 1Password CLI
- ghq
- This plugin uses GitHub CLI
If you want to run a command in for a particular command, let's say foo
, then you can add it by
function your_command_interceptor
# Add your logic
# $argv is arguments from commandline
end
set -U FISH_COMPLETION_INTERCEPTOR_PLUGINS $FISH_COMPLETION_INTERCEPTOR_PLUGINS "foo=your_command_interceptor"
For more details, see the plugin spec doc.
Run make new_fzf_plugin
, and type a command name, then update files for the template for new files.
make install
: Install this plugin into~/.config/fish
usingfisher
make dependencies
: Install dependencies to develop this pluginmake generate:
: Generate configuration files that are supposed to be generated automatically.kubectl
is required.make test
: Run test cases