Bash script for fuzzy finding Salesforce CLI commands and flags with fzf
Fuzzy find Salesforce CLI commands and flags as you type, with live previews of what each command and flag does. No more typos, switching to the browser or running help
to lookup commands and associated options. Autocomplete doesn’t get any better than this!
See it in action below
npm i -g sfdx-cli
)key-bindings.bash
file in $HOME/.fzf.bash
with the path to the file above.sfdx commands --json > ~/.sfdxcommands.json
. (You can add it your .bashrc
source $HOME/.bashrc
.key-bindings.zsh
file in $HOME/.fzf.zsh
with the path to the file above.sfdx commands --json > ~/.sfdxcommands.json
. (You can add it your .zshrc
source $HOME/.zshrc
.Ctrl-e
on a new line to bring up the list of commands to fuzzy search through. The preview window shows up toCtrl-k
and Ctrl-J
to move up and down through the list of commands. Use Alt-K
and Alt-J
to move the preview window up and down, which can be useful for commands with long previews. Hit Enter
to select a command and print it out onto the terminal.sfdx
command in manually (without fzf), hitting Ctrl-e
again will bringEnter
to select the flag and print it out onto the terminal.sfdx
is the only command on a line (i.e. doesn’t work if you are trying to pipe the output of another command to sfdx, for example)sfdx commands --json > ~/.sfdxcommands.json
to your .profile
or .bashrc
file, run the command manually from time to time to keep up with updates to the CLICtrl-e
to bring up sfdx commands. If you’d like to change the mapping, you can change it here (for bash) or here (for zsh)Ctrl-e
from being hijacked by VSC to quick open files and have it be sent to the shell itself. This can be accomplished by adding the following line to settings.json
. Note the hyphen(-
) before the setting name to unbind the action.
"terminal.integrated.commandsToSkipShell": [
"-workbench.action.quickOpen"
]