diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-02-24 02:41:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-24 02:41:00 +0100 |
| commit | 10627e889e82a82560b6fc48ea0ca20e1963d07f (patch) | |
| tree | b6c6a782184f3c60ce5ad7e4636cba93c005fae2 /lua/telescope/actions/init.lua | |
| parent | 4dd35ef0e154ab1836fc923a33196a4101a97a9c (diff) | |
feat: advanced normal mode (#463)
Add <count>j and k to normal mode and H and L to jump at top and bottom of displayed results
Diffstat (limited to 'lua/telescope/actions/init.lua')
| -rw-r--r-- | lua/telescope/actions/init.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index 9286833..5ae284b 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -5,6 +5,7 @@ local a = vim.api local log = require('telescope.log') local state = require('telescope.state') local utils = require('telescope.utils') +local p_scroller = require('telescope.pickers.scroller') local action_state = require('telescope.actions.state') local action_set = require('telescope.actions.set') @@ -69,6 +70,22 @@ function actions.move_selection_previous(prompt_bufnr) action_set.shift_selection(prompt_bufnr, -1) end +function actions.move_to_top(prompt_bufnr) + local current_picker = actions.get_current_picker(prompt_bufnr) + current_picker:set_selection(p_scroller.top(current_picker.sorting_strategy, + current_picker.max_results, + current_picker.manager:num_results() + )) +end + +function actions.move_to_bottom(prompt_bufnr) + local current_picker = actions.get_current_picker(prompt_bufnr) + current_picker:set_selection(p_scroller.bottom(current_picker.sorting_strategy, + current_picker.max_results, + current_picker.manager:num_results() + )) +end + function actions.add_selection(prompt_bufnr) local current_picker = action_state.get_current_picker(prompt_bufnr) current_picker:add_selection(current_picker:get_selection_row()) |
