diff options
| author | elianiva <dicha.arkana03@gmail.com> | 2021-03-05 20:13:48 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-05 20:13:48 +0700 |
| commit | 6e941e0ecec1ab6a1b4ce40c693ef1272c505abb (patch) | |
| tree | 7d8c273d98909a238cdc7f09b7453bfd8577c443 /lua/telescope/actions/init.lua | |
| parent | 8369acea3e6b0258f125ea251111e3217655b11c (diff) | |
feat: define scroll speed + smart_send to qflist (#610)
* smart send to qflist
* Previewer scrolling for half window height
* Start doing cleanup in readme
* feat: add ability to define the scrolling speed
* move scrolling action to action.set
* docs: added more docs for actions
* [docgen] Update doc/telescope.txt
skip-checks: true
Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
Co-authored-by: Github Actions <actions@github>
Diffstat (limited to 'lua/telescope/actions/init.lua')
| -rw-r--r-- | lua/telescope/actions/init.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index 79bcb23..cf230e7 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -144,13 +144,11 @@ function actions.toggle_selection(prompt_bufnr) end function actions.preview_scrolling_up(prompt_bufnr) - -- TODO: Make number configurable. - action_state.get_current_picker(prompt_bufnr).previewer:scroll_fn(-30) + action_set.scroll_previewer(prompt_bufnr, -1) end function actions.preview_scrolling_down(prompt_bufnr) - -- TODO: Make number configurable. - action_state.get_current_picker(prompt_bufnr).previewer:scroll_fn(30) + action_set.scroll_previewer(prompt_bufnr, 1) end function actions.center(_) @@ -413,6 +411,16 @@ actions.send_to_qflist = function(prompt_bufnr) vim.fn.setqflist(qf_entries, 'r') end +actions.smart_send_to_qflist = function(prompt_bufnr) + local picker = action_state.get_current_picker(prompt_bufnr) + if table.getn(picker:get_multi_selection()) > 0 then + actions.send_selected_to_qflist(prompt_bufnr) + else + actions.send_to_qflist(prompt_bufnr) + end +end + +--- Open the quickfix list actions.open_qflist = function(_) vim.cmd [[copen]] end |
