TLDR I'm trying to make this work :
command! FZFCd : set noquickview
\| let $FZF_PICK = term('fd --type file | fzf-tmux -p 80%% --prompt "Files> " --header "CTRL-T: Switch between Files/Directories" --bind "ctrl-t:transform:[[ ! $FZF_PROMPT =~ Files ]] &&
\ echo \"change-prompt(Files> )+reload(fd --type file --hidden)\" ||
\ echo \"change-prompt(Dirs > )+reload(fd --type directory --hidden)\"" 2>/dev/tty')
\| if $FZF_PICK != ''
\| execute 'goto' fnameescape($FZF_PICK)
\| endif
I'm basically tring to add ++ctrl+t++ key bind to reload and toggle between files and dirs and writing it across multiple lines so for now.
I'd also make it easier if there was a way to access fzf functions declared in "fzf/shell/key_binding.bash" in vifm fzf for execution
Also my next step is to add this conglomorate in vifm which is now located in the "fzf/shell/key_binding.bash" would there be any functionality issues integrating it using the same philosophy as in this function in vifm? what is recommanded to do in porting such a function to vifm?
fzfCd() {
local FILE_PICKER_CMD="fd --hidden"
# set -x
local SearchPath=~
local dir=""
local Cwd="$(pwd)/"
dir=$(fd --type directory --hidden . | fzf-tmux --ansi \
--bind "start:transform-header(echo ${Cwd})+execute-silent(echo "$Cwd" | tee /tmp/fpicker-dir)" \
--bind "ctrl-r:transform([[ -n {q} ]] && echo \"execute-silent(echo {q} | tee /tmp/fpicker-dir)\" || echo \"execute-silent(echo ${Cwd} | tee /tmp/fpicker-dir)\")+transform-query(cat /tmp/fpicker-dir)+transform-header(cat /tmp/fpicker-dir)+transform:[[ {fzf:prompt} =~ Files ]] &&
echo \"reload(${FILE_PICKER_CMD} --type file . {q})+transform-header(cat /tmp/fpicker-dir)+change-query()\" ||
echo \"reload(${FILE_PICKER_CMD} --type directory . {q})+transform-header(cat /tmp/fpicker-dir)+change-query()\"" \
--bind "ctrl-e:execute-silent(echo \"/\" > /tmp/fpicker-dir)+transform-header(cat /tmp/fpicker-dir)+transform:[[ {fzf:prompt} =~ Files ]] &&
echo \"reload(${FILE_PICKER_CMD} --type file . \"/\")+transform-header(cat /tmp/fpicker-dir)\" ||
echo \"reload(${FILE_PICKER_CMD} --type directory . \"/\")+transform-header(cat /tmp/fpicker-dir)\"" \
--bind "ctrl-d:execute-silent(echo \"/home/pong/\" > /tmp/fpicker-dir)+transform-header(cat /tmp/fpicker-dir)+transform:[[ {fzf:prompt} =~ Files ]] &&
echo \"reload(${FILE_PICKER_CMD} --type file . \"/home/pong/.config\")+transform-header(cat /tmp/fpicker-dir)\" ||
echo \"reload(${FILE_PICKER_CMD} --type directory . \"/home/pong/.config\")+transform-header(cat /tmp/fpicker-dir)\"" \
--bind "ctrl-b:execute-silent(echo \"$Cwd\" > /tmp/fpicker-dir)+transform-header(cat /tmp/fpicker-dir)+transform:[[ {fzf:prompt} =~ Files ]] &&
echo \"reload(${FILE_PICKER_CMD} --type file . \"/home/pong/.config\")+transform-header(cat /tmp/fpicker-dir)\" ||
echo \"reload(${FILE_PICKER_CMD} --type directory . \"/home/pong/.config\")+transform-header(cat /tmp/fpicker-dir)\"" \
--bind "ctrl-t:transform(echo {fzf:query} > /tmp/fzf-q)+transform-query(cat /tmp/fpicker-dir)+transform:[[ ! {fzf:prompt} =~ Files ]] &&
echo \"change-prompt(Files >)+reload(${FILE_PICKER_CMD} --type file . {q})+transform-header(cat /tmp/fpicker-dir)+transform-query(cat /tmp/fzf-q)\" ||
echo \"change-prompt(Dirs >)+reload(${FILE_PICKER_CMD} --type directory . {q})+transform-header(cat /tmp/fpicker-dir)+transform-query(cat /tmp/fzf-q)\"" \
--bind "ctrl-f:transform:[[ ! {fzf:prompt} =~ Files ]] &&
echo \"change-prompt(Files >)+reload(${FILE_PICKER_CMD} --type file . \$\(cat /tmp/fpicker-dir\))+transform-header(cat /tmp/fpicker-dir)+transform-query(cat /tmp/fzf-q)\" ||
echo \"change-prompt(Dirs >)+reload(${FILE_PICKER_CMD} --type directory . \$\(cat /tmp/fpicker-dir\))+transform-header(cat /tmp/fpicker-dir)+transform-query(cat /tmp/fzf-q)\"" \
--preview '[[ $FZF_PROMPT =~ Files ]] && bat --color=always {} || tree -C {}' \
--prompt "Dirs >" \
--border "rounded" \
--border-label "CD Tool" \
+m)
[[ -d ${dir} ]] && builtin cd "$dir" &> /dev/null || builtin cd $(echo ${dir} | awk -F '/[^/]*$' '{print $1}') &> /dev/null
return 0
}