How to bind key to search for a file and paste the path to the command l
From:
Marcin Barczyński
Subject:
How to bind key to search for a file and paste the path to the command line?
Date:
Thu, 19 Mar 2020 18:22:18 +0100
fzf (https://github.com/junegunn/fzf) is a program that let you find things
easily and prints the selected item to stdout.
For instance:
$ find . | fzf
/home/user/a/script/very/deep/in/the/directory/tree/foo
To make my life easier I would like to bind Ctrl-F to run "find . | fzf"
and insert the path at the position of cursor:
$ cat <Ctrl-F> # runs find . | fzf
$ cat /my/script
How to do it in bash?
I tried:
$ bind -x '"\C-f":"find . | fzf"'
but it prints the path to stdout instead:
$ cat <Ctrl-F> # runs find . | fzf
/my/script
$ cat
--
Best Regards,
Marcin