mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 09:33:42 -05:00
fe with ctrl-o
15
Examples.md
15
Examples.md
@@ -12,11 +12,16 @@ fe() {
|
|||||||
[ -n "$file" ] && ${EDITOR:-vim} "$file"
|
[ -n "$file" ] && ${EDITOR:-vim} "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Equivalent to above, but opens it with `open` command
|
# Extended version where you can press CTRL-O to open with `open` command
|
||||||
fo() {
|
# fe [FUZZY PATTERN]
|
||||||
local file
|
fe() {
|
||||||
file=$(fzf --query="$1" --select-1 --exit-0)
|
local out file key
|
||||||
[ -n "$file" ] && open "$file"
|
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