feat: cycle prompt history (#521)

history is enabled on default but cycle_history_next and cycle_history_prev is not mapped yet

Example:
require('telescope').setup {
  defaults = {
    mappings = {
      i = {
        ["<C-Down>"] = require('telescope.actions').cycle_history_next,
        ["<C-Up>"] = require('telescope.actions').cycle_history_prev,
      }
    }
  }
}

For more information :help telescope.defaults.history

big thanks to clason and all other testers :)
This commit is contained in:
Simon Hauser
2021-07-09 20:45:29 +02:00
committed by GitHub
parent 385020eb23
commit 3699605627
9 changed files with 1098 additions and 625 deletions

View File

@@ -473,7 +473,7 @@ function Picker:find()
pcall(a.nvim_buf_set_option, prompt_bufnr, 'filetype', 'TelescopePrompt')
if self.default_text then
vim.api.nvim_buf_set_lines(prompt_bufnr, 0, 1, false, {self.default_text})
self:set_prompt(self.default_text)
end
if self.initial_mode == "insert" then
@@ -544,6 +544,11 @@ function Picker:delete_selection(delete_cb)
end)
end
function Picker:set_prompt(str)
-- TODO(conni2461): As soon as prompt_buffers are fix use this:
-- vim.api.nvim_buf_set_lines(self.prompt_bufnr, 0, 1, false, { str })
vim.api.nvim_feedkeys(str, 'n', false)
end
function Picker.close_windows(status)
local prompt_win = status.prompt_win