mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 01:23:43 -05:00
fe with ctrl-o
15
Examples.md
15
Examples.md
@@ -12,11 +12,16 @@ fe() {
|
||||
[ -n "$file" ] && ${EDITOR:-vim} "$file"
|
||||
}
|
||||
|
||||
# Equivalent to above, but opens it with `open` command
|
||||
fo() {
|
||||
local file
|
||||
file=$(fzf --query="$1" --select-1 --exit-0)
|
||||
[ -n "$file" ] && open "$file"
|
||||
# Extended version where you can press CTRL-O to open with `open` command
|
||||
# fe [FUZZY PATTERN]
|
||||
fe() {
|
||||
local out file key
|
||||
out=$(fzf-tmux --query="$1" --exit-0 --expect=ctrl-o)
|
||||
key=$(head -1 <<< "$out")
|
||||
file=$(head -2 <<< "$out" | tail -1)
|
||||
if [ -n "$file" ]; then
|
||||
[ "$key" = ctrl-o ] && open "$file" || ${EDITOR:-vim} "$file"
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user