From 5125bbdb54bba8339f3dc71dbfca714719408567 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 13 Dec 2016 15:36:43 +0530 Subject: [PATCH] Commandline: Add fzf-select --- Examples-(fish).md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Examples-(fish).md b/Examples-(fish).md index abde7db..e6c0df2 100644 --- a/Examples-(fish).md +++ b/Examples-(fish).md @@ -28,6 +28,19 @@ function fzf-cdhist-widget -d 'cd to one of the previously visited location' end ``` +### Commandline + +The following is useful to manipulate the commandline from the result of jobs. For instance, calling `fzf-select` over `pacman -Qlq fzf` will allow you to select files in the `fzf` package and print them bck to commandline for further manipulation. +``` +function fzf-select -d 'fzf commandline job and print unescaped selection back to commandline' + set -l cmd (commandline -j) + [ "$cmd" ]; or return + eval $cmd | eval (__fzfcmd) -m --tiebreak=index --select-1 --exit-0 | string join ' ' | read -l result + [ "$result" ]; and commandline -j -- $result + commandline -f repaint +end +``` + ### Git ```