From 10627e889e82a82560b6fc48ea0ca20e1963d07f Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Wed, 24 Feb 2021 02:41:00 +0100 Subject: feat: advanced normal mode (#463) Add j and k to normal mode and H and L to jump at top and bottom of displayed results --- lua/telescope/pickers/scroller.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lua/telescope/pickers/scroller.lua') diff --git a/lua/telescope/pickers/scroller.lua b/lua/telescope/pickers/scroller.lua index 3169c4b..8b84e7c 100644 --- a/lua/telescope/pickers/scroller.lua +++ b/lua/telescope/pickers/scroller.lua @@ -73,4 +73,18 @@ scroller.create = function(scroll_strategy, sorting_strategy) end end +scroller.top = function(sorting_strategy, max_results, num_results) + if sorting_strategy == 'ascending' then + return 0 + end + return (num_results > max_results) and 0 or (max_results - num_results) +end + +scroller.bottom = function(sorting_strategy, max_results, num_results) + if sorting_strategy == 'ascending' then + return math.min(max_results, num_results) - 1 + end + return max_results - 1 +end + return scroller -- cgit v1.2.3