From 60b17c9c70db0c6f42b33068c604aca5902633db Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Fri, 16 Jan 2015 09:01:28 +0100 Subject: [PATCH] peco_select_history can take initial query --- plugins/peco/README | 9 --------- plugins/peco/README.md | 13 +++++++++++++ plugins/peco/peco_select_history.fish | 9 ++++++++- 3 files changed, 21 insertions(+), 10 deletions(-) delete mode 100644 plugins/peco/README create mode 100644 plugins/peco/README.md diff --git a/plugins/peco/README b/plugins/peco/README deleted file mode 100644 index 33a9abb..0000000 --- a/plugins/peco/README +++ /dev/null @@ -1,9 +0,0 @@ -Based directly on the percol plugin. - -Please bind peco_select_history in your favorite key. - -If you'd like to bind CTRL+R - -function fish_user_key_bindings - bind \cr peco_select_history -end diff --git a/plugins/peco/README.md b/plugins/peco/README.md new file mode 100644 index 0000000..d8819ca --- /dev/null +++ b/plugins/peco/README.md @@ -0,0 +1,13 @@ +peco +---- + +Based directly on the percol plugin. + +Please bind peco_select_history to your favorite key. + +If you'd like to bind CTRL+R +``` +function fish_user_key_bindings + bind \cr 'peco_select_history (commandline -b)' +end +``` diff --git a/plugins/peco/peco_select_history.fish b/plugins/peco/peco_select_history.fish index 57f185b..5aad015 100644 --- a/plugins/peco/peco_select_history.fish +++ b/plugins/peco/peco_select_history.fish @@ -1,5 +1,12 @@ function peco_select_history - history|peco|read foo + if test (count $argv) = 0 + set peco_flags --layout=bottom-up + else + set peco_flags --layout=bottom-up --query "$argv" + end + + history|peco $peco_flags|read foo + if [ $foo ] commandline $foo else