From a3cec536b2e1569f5e30b96fbd20af5ae2782543 Mon Sep 17 00:00:00 2001 From: Pablo Aguiar Date: Mon, 27 Apr 2015 10:35:52 -0300 Subject: [PATCH] config.fish: improve documentation on creating Fish functions (fix #128 an #76) --- Shell-aliases.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Shell-aliases.md b/Shell-aliases.md index fdb5856..be632c2 100644 --- a/Shell-aliases.md +++ b/Shell-aliases.md @@ -9,8 +9,16 @@ alias fuck='eval $(thefuck $(fc -ln -1))' Add this function to `config.fish`: ```fish -function fuck - eval (thefuck $history[1]) +function __thefuck_repl -d 'Replace operators into fish-compatible' + set -l tmp (echo $argv | sed 's/ && / ; and /g') + echo $tmp | sed 's/ || / ; or /g' +end + +function fuck -d 'Correct your previous console command' + set -l eval_script (mktemp 2>/dev/null ; or mktemp -t 'thefuck') + thefuck $history[1] > $eval_script + eval (__thefuck_repl (cat $eval_script)) + rm $eval_script end ```