m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-19 00:53:42 -05:00

fe

Junegunn Choi
2016-10-05 00:21:46 +09:00
parent 30cc2f41f2
commit 61fddc19c5

@@ -7,11 +7,9 @@ You can replace `fzf` command on each example with [`fzf-tmux`](https://github.c
# - Bypass fuzzy finder if there's only one match (--select-1) # - Bypass fuzzy finder if there's only one match (--select-1)
# - Exit if there's no match (--exit-0) # - Exit if there's no match (--exit-0)
fe() { fe() {
IFS=' local files
' IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0))
local declare files=($(fzf-tmux --query="$1" --select-1 --exit-0))
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
unset IFS
} }
# Modified version where you can press # Modified version where you can press
@@ -19,7 +17,7 @@ fe() {
# - CTRL-E or Enter key to open with the $EDITOR # - CTRL-E or Enter key to open with the $EDITOR
fo() { fo() {
local out file key local out file key
out=$(fzf-tmux --query="$1" --exit-0 --expect=ctrl-o,ctrl-e) IFS=$'\n' out=($(fzf-tmux --query="$1" --exit-0 --expect=ctrl-o,ctrl-e))
key=$(head -1 <<< "$out") key=$(head -1 <<< "$out")
file=$(head -2 <<< "$out" | tail -1) file=$(head -2 <<< "$out" | tail -1)
if [ -n "$file" ]; then if [ -n "$file" ]; then