Skip to content

Enabling fzf to paste the absolute path of selected files into the command line. #3307

Closed Answered by lime-desu
yrammos asked this question in Q&A
Discussion options

You must be logged in to vote

You can set it on your environment variables,

  1. First solution:
    If you're using fd, there's this --absolute-path flag e.g:
if command -v fd >/dev/null 2>&1; then
    export FZF_DEFAULT_COMMAND="fd --absolute-path --color=always --hidden --exclude .git"
else
    export FZF_DEFAULT_COMMAND="find ~+ -type f \! \( -path '*/.git' -prune \) -printf '%P\n'"
fi
  1. Another solution (since on first one, the display results are very long, because of the absolute path),
    Now on the Ctrl-t widget pressing enter would append the $PWD/{selected line buffer}
export FZF_CTRL_T_OPTS="--bind 'enter:execute(echo $PWD/{$BUFFER})+abort'"

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yrammos
Comment options

Answer selected by yrammos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants