nvim-telescope/telescope.nvim

[feature request] actions.results_move_coursor_down

gmankab opened this issue · 8 comments

so, there is actions.results_scrolling_down and actions.results_scrolling_up methods

this methods scolls but do not moves coursor

can you please add methods that will move corsor?

i tried to do this:

local feedkeys_up = vim.api.nvim_replace_termcodes('8<up>', true, true, true)
local feedkeys_down = vim.api.nvim_replace_termcodes('8<down>', true, true, true)

local function move_coursor_up()
  vim.api.nvim_feedkeys(feedkeys_up, 'm', false)
end

local function move_coursor_down()
  vim.api.nvim_feedkeys(feedkeys_down, 'm', false)
end

telescope.setup {
  defaults = {
    mappings = {
      n = {
        ['u'] = move_coursor_up,
        ['d'] = move_coursor_down,
      },
    },
  },
}

this code moves coursor 8 tims up or down on u and d keys

and this code is very slow, because it renders file preview each time, so scrolling 8 lines is 8 times slower then expected

Try this:

local action_set = require "telescope.actions.set"

local function move_coursor_up(prompt_bufnr)
  action_set.shift_selection(prompt_bufnr, 8)
end

local function move_coursor_down(prompt_bufnr)
  action_set.shift_selection(prompt_bufnr, -8)
end

telescope.setup {
  defaults = {
    mappings = {
      n = {
        ['u'] = move_coursor_up,
        ['d'] = move_coursor_down,
      },
    },
  },
}

Oh sorry replace "action_state" with "action_set", same if the import statement, "state" to "set".

it works, but i feel same delay when scrolling down

also, for and unknown reason there is no delay when scrolling up, in both cases with telescope.actions.set.shift_selection and with vim.api.nvim_feedkeys

It works instantly for me. The delay is likely due to overlapping keymap(s) so neovim is waiting the timeoutlen.

is there any workarounds to prevent the delay?

Check :nmap d (similarly for "u") and figure out what keymaps are overlapping. Then you change them to something else. Or change the telescope u/d mappings to some other keys.

Or you can decrease the timeoutlen and live with the delay/conflict.

thank you