diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-07-09 20:45:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-09 20:45:29 +0200 |
| commit | 36996056272a7174868367acf1043cead333d115 (patch) | |
| tree | cd5a33dac60c9c5ee6ae17b6be2f51fa44b52562 /lua/telescope/pickers.lua | |
| parent | 385020eb232b48a5a3583f531ff27266fb06eec4 (diff) | |
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 :)
Diffstat (limited to 'lua/telescope/pickers.lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index a60d2df..449d869 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -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 |
