Skip to content

Integrate with Telescope #89

Description

@WingsZeng

I'm trying to integrate this plugin with Telescope.nvim to achieve smooth scrolling behavior. In my attempt, I used the following code, but it did not work as expected:

specs = {
  {
    "nvim-telescope/telescope.nvim",
    optional = true,
    opts = function(_, opts)
      local cinnamon = require "cinnamon"
      local maps = opts.defaults.mappings
      local action_i_cr = maps.i["<CR>"]
      maps.i["<CR>"] = function(prompt_bufnr)
        cinnamon.scroll(function()
          action_i_cr(prompt_bufnr)
          vim.cmd "normal! zz"
        end)
      end
    end
  }
}

I noticed that if I write the code like this, the Telescope jump itself doesn't scroll smoothly, but the subsequent cinnamon.scroll("zz") works as expected:

maps.i["<CR>"] = function(prompt_bufnr)
  action_i_cr(prompt_bufnr)
  cinnamon.scroll("zz")
end

I wonder if it is possible to integrate with Telescope.nvim in a way that includes the scrolling during the jump?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions