mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 21:05:09 +00:00
Add fe
command to examples section as suggested in #27
This commit is contained in:
parent
0a8352a5cd
commit
f02bb4fdac
23
README.md
23
README.md
@ -176,6 +176,29 @@ fco() {
|
|||||||
commit=$(echo "$commits" | fzf +s +m -e) &&
|
commit=$(echo "$commits" | fzf +s +m -e) &&
|
||||||
git checkout $(echo "$commit" | sed "s/ .*//")
|
git checkout $(echo "$commit" | sed "s/ .*//")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# fq1 [QUERY]
|
||||||
|
# - Immediately select the file when there's only one match.
|
||||||
|
# If not, start the fuzzy finder as usual.
|
||||||
|
fq1() {
|
||||||
|
local lines
|
||||||
|
lines=$(fzf --filter="$1" --no-sort)
|
||||||
|
if [ -z "$lines" ]; then
|
||||||
|
return 1
|
||||||
|
elif [ $(wc -l <<< "$lines") -eq 1 ]; then
|
||||||
|
echo "$lines"
|
||||||
|
else
|
||||||
|
echo "$lines" | fzf --query="$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# fe [QUERY]
|
||||||
|
# - Open the selected file with the default editor
|
||||||
|
# (Bypass fuzzy finder when there's only one match)
|
||||||
|
fe() {
|
||||||
|
local file
|
||||||
|
file=$(fq1 "$1") && ${EDITOR:-vim} "$file"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Key bindings for command line
|
Key bindings for command line
|
||||||
|
Loading…
Reference in New Issue
Block a user