From 3ca3b6209d0da6f233ed71c6c03ec6bfc4dd71fc Mon Sep 17 00:00:00 2001 From: liljencrantz Date: Sat, 6 Oct 2007 20:32:31 +1000 Subject: [PATCH] Make the Alt-p keybinding respect the PAGER variable darcs-hash:20071006103231-75c98-59ef22ad49526f52cff8a97d9fac9f003af19213.gz --- share/functions/__fish_paginate.fish | 13 +++++++++++++ share/functions/fish_default_key_bindings.fish | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 share/functions/__fish_paginate.fish diff --git a/share/functions/__fish_paginate.fish b/share/functions/__fish_paginate.fish new file mode 100644 index 000000000..992993b6c --- /dev/null +++ b/share/functions/__fish_paginate.fish @@ -0,0 +1,13 @@ +function __fish_paginate -d "Paginate the current command using the users default pager" + + set -l cmd less + if set -q PAGER + set cmd $PAGER + end + + if commandline -j|grep -v "$cmd *\$" >/dev/null + + commandline -aj "|$cmd;" + end + +end diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index 6340810bc..60fefc3b8 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -85,7 +85,7 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis bind \cd delete-or-exit # This will make sure the output of the current command is paged using the less pager when you press Meta-p - bind \ep 'if commandline -j|grep -v "less *\$" >/dev/null; commandline -aj "|less;"; end' - + bind \ep '__fish_paginate' + end