I'd like to use FZF to search for files and then have them open in an editor of my choice e.g. Sublime, Atom. I'm not sure how to configure my shell for this, I've tried the below but I can't get it to work.
Can you help?
Thanks!
fe() {
local files
IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0))
[[ -n "$files" ]] && ${EDITOR:-atom} "${files[@]}"
}
Based on your comments, it is possible the only problem comes from this part :
${EDITOR:-atom}
This expands to the content of variable EDITOR if has a non-null value, and to atom
if it is null or unset. It is likely you have that variable initialized to something else than atom
. Try using simply atom
instead, like this:
fe() {
local files
IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0))
[[ -n "$files" ]] && atom "${files[@]}"
}
Of course, you can also keep the function as it already is, but make sure your environment contains something like EDITOR=atom
.