Skip to content

Commit 3537559

Browse files
committed
always list Search Commands in alphabetical order
This includes in the Search Commands section, the custom opts section, fzf_configure_bindings_help, and fzf_configure_bindings code. Makes reading the docs and code slightly easier and prevents bike-shedding of where to add in the next search command we add.
1 parent a8ef424 commit 3537559

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ Use `fzf.fish` to interactively find and insert file paths, git commit hashes, a
2727
- if the current token is a directory with a trailing slash (e.g. `.config/<CURSOR>`), then that directory is searched instead
2828
- [ignores files that are also ignored by git](#fd-gi)
2929

30-
### 📝 Search Git Status
31-
32-
![gif git status](../assets/git_status.gif)
33-
34-
- **Fzf input:** the current repository's `git status`
35-
- **Output:** relative paths of selected lines
36-
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd> (`S` for status)
37-
- **Preview window:** the git diff of the file
38-
3930
### 🪵 Search Git Log
4031

4132
![gif git log](../assets/git_log.gif)
@@ -45,6 +36,15 @@ Use `fzf.fish` to interactively find and insert file paths, git commit hashes, a
4536
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd> (`L` for log)
4637
- **Preview window:** commit message and diff
4738

39+
### 📝 Search Git Status
40+
41+
![gif git status](../assets/git_status.gif)
42+
43+
- **Fzf input:** the current repository's `git status`
44+
- **Output:** relative paths of selected lines
45+
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd> (`S` for status)
46+
- **Preview window:** the git diff of the file
47+
4848
### 📜 Search History
4949

5050
![gif command history](../assets/command_history.gif)
@@ -54,16 +54,6 @@ Use `fzf.fish` to interactively find and insert file paths, git commit hashes, a
5454
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>R</kbd> (`R` for reverse-i-search)
5555
- **Preview window:** the entire command with Fish syntax highlighting
5656

57-
### 🐚 Search Variables
58-
59-
![gif shell variables](../assets/shell_variables.gif)
60-
61-
- **Fzf input:** all the shell variables currently [in scope][var scope]
62-
- **Output:** selected shell variables
63-
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>V</kbd> (`V` for variable)
64-
- **Preview window:** the variable's scope info and values
65-
- `$history` is excluded for technical reasons so use [Search History](#-search-history) instead to inspect it
66-
6757
### 🖥️ Search Processes
6858

6959
![gif processes](../assets/processes.gif)
@@ -73,6 +63,16 @@ Use `fzf.fish` to interactively find and insert file paths, git commit hashes, a
7363
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd> (`P` for process)
7464
- **Preview window:** the CPU usage, memory usage, start time, and other information about the process
7565

66+
### 💲 Search Variables
67+
68+
![gif shell variables](../assets/shell_variables.gif)
69+
70+
- **Fzf input:** all the shell variables currently [in scope][var scope]
71+
- **Output:** selected shell variables
72+
- **Key binding and mnemonic:** <kbd>Ctrl</kbd>+<kbd>V</kbd> (`V` for variable)
73+
- **Preview window:** the variable's scope info and values
74+
- `$history` is excluded for technical reasons so use [Search History](#-search-history) instead to inspect it
75+
7676
## Installation
7777

7878
First, install a proper version of these CLI dependencies:
@@ -119,11 +119,11 @@ The following variables can store custom options that will be passed to fzf by t
119119
| Command | Variable |
120120
| ----------------- | --------------------- |
121121
| Search Directory | `fzf_dir_opts` |
122-
| Search Git Status | `fzf_git_status_opts` |
123122
| Search Git Log | `fzf_git_log_opts` |
123+
| Search Git Status | `fzf_git_status_opts` |
124124
| Search History | `fzf_history_opts` |
125-
| Search Variables | `fzf_shell_vars_opts` |
126125
| Search Processes | `fzf_processes_opts` |
126+
| Search Variables | `fzf_shell_vars_opts` |
127127

128128
They are appended last to fzf's options list. Because fzf uses the last instance of an option if it is specified multiple times, custom options will always take precedence. Custom fzf options unlock a variety of customizations and augmentations such as:
129129

completions/fzf_configure_bindings.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ complete fzf_configure_bindings --long directory --description "Change the key b
44
complete fzf_configure_bindings --long git_log --description "Change the key binding for searching git log"
55
complete fzf_configure_bindings --long git_status --description "Change the key binding for searching git status"
66
complete fzf_configure_bindings --long history --description "Change the key binding for searching history"
7-
complete fzf_configure_bindings --long variables --description "Change the key binding for searching variables"
87
complete fzf_configure_bindings --long processes --description "Change the key binding for searching processes"
8+
complete fzf_configure_bindings --long variables --description "Change the key binding for searching variables"

functions/_fzf_configure_bindings_help.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ DESCRIPTION
1515
Search Git Log | Ctrl+Alt+L (L for log) | --git_log
1616
Search Git Status | Ctrl+Alt+S (S for status) | --git_status
1717
Search History | Ctrl+R (R for reverse) | --history
18-
Search Variables | Ctrl+V (V for variable) | --variables
1918
Search Processes | Ctrl+Alt+P (P for process) | --processes
19+
Search Variables | Ctrl+V (V for variable) | --variables
2020
Override a command's binding by specifying its corresponding option with the desired key
2121
sequence. Disable a command's binding by specifying its corresponding option with no value.
2222

functions/fzf_configure_bindings.fish

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function fzf_configure_bindings --description "Installs the default key bindings
44
# no need to install bindings if not in interactive mode or running tests
55
status is-interactive || test "$CI" = true; or return
66

7-
set options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'variables=?' 'processes=?'
7+
set options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?'
88
argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
99
if test $status -ne 0
1010
echo "Invalid option or a positional argument was provided." >&2
@@ -15,14 +15,14 @@ function fzf_configure_bindings --description "Installs the default key bindings
1515
return
1616
else
1717
# Initialize with default key sequences and then override or disable them based on flags
18-
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = variables, 6 = processes
19-
set key_sequences \e\cf \e\cl \e\cs \cr \cv \e\cp # \c = control, \e = escape
18+
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
19+
set key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape
2020
set --query _flag_directory && set key_sequences[1] "$_flag_directory"
2121
set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
2222
set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
2323
set --query _flag_history && set key_sequences[4] "$_flag_history"
24-
set --query _flag_variables && set key_sequences[5] "$_flag_variables"
25-
set --query _flag_processes && set key_sequences[6] "$_flag_processes"
24+
set --query _flag_processes && set key_sequences[5] "$_flag_processes"
25+
set --query _flag_variables && set key_sequences[6] "$_flag_variables"
2626

2727
# If fzf bindings already exists, uninstall it first for a clean slate
2828
if functions --query _fzf_uninstall_bindings
@@ -34,8 +34,8 @@ function fzf_configure_bindings --description "Installs the default key bindings
3434
test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
3535
test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
3636
test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
37-
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] "$_fzf_search_vars_command"
38-
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] _fzf_search_processes
37+
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
38+
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
3939
end
4040

4141
function _fzf_uninstall_bindings --inherit-variable key_sequences

0 commit comments

Comments
 (0)