feat & fix: Command History Picker (#656)
This commit is contained in:
@@ -220,6 +220,12 @@ function actions.close(prompt_bufnr)
|
||||
do_close(prompt_bufnr, false)
|
||||
end
|
||||
|
||||
actions.edit_command_line = function(prompt_bufnr)
|
||||
local entry = action_state.get_selected_entry(prompt_bufnr)
|
||||
actions.close(prompt_bufnr)
|
||||
a.nvim_feedkeys(a.nvim_replace_termcodes(":" .. entry.value , true, false, true), "t", true)
|
||||
end
|
||||
|
||||
actions.set_command_line = function(prompt_bufnr)
|
||||
local entry = action_state.get_selected_entry(prompt_bufnr)
|
||||
|
||||
|
||||
@@ -263,6 +263,9 @@ internal.command_history = function(opts)
|
||||
|
||||
attach_mappings = function(_, map)
|
||||
map('i', '<CR>', actions.set_command_line)
|
||||
map('n', '<CR>', actions.set_command_line)
|
||||
map('n', '<C-e>', actions.edit_command_line)
|
||||
map('i', '<C-e>', actions.edit_command_line)
|
||||
|
||||
-- TODO: Find a way to insert the text... it seems hard.
|
||||
-- map('i', '<C-i>', actions.insert_value, { expr = true })
|
||||
|
||||
Reference in New Issue
Block a user