Skip to content

Commit

Permalink
[fzf_configure_bindings] update help message (#267)
Browse files Browse the repository at this point in the history
Received helpful feedback on fzf_configure_bindings confusing parts on https://www.reddit.com/r/fishshell/comments/y1hovw/request_for_feedback_on_fzffish_quick_survey
  • Loading branch information
PatrickF1 authored Oct 13, 2022
1 parent 1ee5726 commit 242843e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fisher install PatrickF1/fzf.fish

### Customize key bindings

`fzf.fish` includes an ergonomic wrapper for configuring its key bindings. Read its documentation with this command:
`fzf.fish` includes an ergonomic wrapper for configuring its key bindings. Read [its documentation](/functions/_fzf_configure_bindings_help.fish) with this command:

```fish
fzf_configure_bindings --help
Expand Down
48 changes: 24 additions & 24 deletions functions/_fzf_configure_bindings_help.fish
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
echo "\
USAGE:
fzf_configure_bindings [--FEATURE[=KEY_SEQUENCE]...]
fzf_configure_bindings [--FEATURE=[KEY_SEQUENCE]...]
DESCRIPTION
By default, fzf_configure_bindings installs mnemonic key bindings for fzf.fish's features. Each
feature's binding can be customized through a corresponding namesake option:
FEATURE | MNEMONIC KEY SEQUENCE | CORRESPONDING OPTION
fzf_configure_bindings installs key bindings for fzf.fish's features and erases any bindings it
previously installed. It installs bindings for both default and insert modes. fzf.fish executes
it without options on fish startup to install the out-of-the-box key bindings.
By default, feature are bound to a mnemonic key sequence, shown below. Each feature's binding
can be configured using a namesake corresponding option:
FEATURE | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
Search directory | Ctrl+Alt+F (F for file) | --directory
Search git log | Ctrl+Alt+L (L for log) | --git_log
Search git status | Ctrl+Alt+S (S for status) | --git_status
Search history | Ctrl+R (R for reverse) | --history
Search variables | Ctrl+V (V for variable) | --variables
Search processes | Ctrl+Alt+P (P for process) | --processes
An option with a key sequence value overrides the binding for its feature, while an option
without a value disables the binding. A feature that is not customized retains its default
menomonic binding specified above. Key bindings are installed for default and insert modes.
Override a feature's binding by specifying its corresponding option with the desired key
sequence. Disable a feature's binding by specifying its corresponding option with no value.
In terms of validation, fzf_configure_bindings fails if passed unknown options. Furthermore, it
expects an equals sign between an option's name and value. However, it does not validate key
sequences. Rather, consider using fish_key_reader to manually validate them.
Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
to your config.fish in order to persist the customized bindings.
In terms of experimentation, fzf_configure_bindings erases any bindings it previously installed
before installing new ones so it can be repeatedly executed in the same fish session without
problem. Once the desired fzf_configure_bindings command has been found, add it to config.fish
in order to persist the bindings.
In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
equals sign between an option's name and value. However, it does not validate key sequences.
The -h and --help options print this help message.
Pass -h or --help to print this help message and exit.
EXAMPLES
Install the default mnemonic bindings
\$ fzf_configure_bindings
Install the default bindings but override git log's binding to Ctrl+G
\$ fzf_configure_bindings --git_log=\cg
Install the default bindings but leave search history unbound
\$ fzf_configure_bindings --history
Alternative style of disabling search history
Default bindings but bind search directory to Ctrl+F and search variables to Ctrl+Alt+V
\$ fzf_configure_bindings --directory=\cf --variables=\e\cv
Default bindings but disable search history
\$ fzf_configure_bindings --history=
An agglomeration of all the options
\$ fzf_configure_bindings --git_status=\cg --history=\ch --variables --directory --git_log
An agglomeration of different options
\$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
SEE Also
To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
"
end

0 comments on commit 242843e

Please sign in to comment.