fix: move to actions.select as default action (#465)
This commit is contained in:
@@ -47,7 +47,7 @@ internal.builtin = function(opts)
|
||||
previewer = previewers.builtin.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(_)
|
||||
actions.goto_file_selection_edit:replace(actions.run_builtin)
|
||||
actions.select:replace(actions.run_builtin)
|
||||
return true
|
||||
end
|
||||
}):find()
|
||||
@@ -82,7 +82,7 @@ internal.planets = function(opts)
|
||||
previewer = previewers.cat.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
@@ -137,7 +137,7 @@ internal.symbols = function(opts)
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(_)
|
||||
actions.goto_file_selection_edit:replace(actions.insert_symbol)
|
||||
actions.select:replace(actions.insert_symbol)
|
||||
return true
|
||||
end
|
||||
}):find()
|
||||
@@ -168,7 +168,7 @@ internal.commands = function(opts)
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
local val = selection.value
|
||||
@@ -285,7 +285,7 @@ internal.vim_options = function(opts)
|
||||
-- previewer = previewers.help.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function()
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
local esc = ""
|
||||
|
||||
@@ -411,7 +411,7 @@ internal.help_tags = function(opts)
|
||||
previewer = previewers.help.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions._goto_file_selection:replace(function(_, cmd)
|
||||
actions._select:replace(function(_, cmd)
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
if cmd == 'edit' or cmd == 'new' then
|
||||
@@ -440,7 +440,7 @@ internal.man_pages = function(opts)
|
||||
previewer = previewers.man.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions._goto_file_selection:replace(function(_, cmd)
|
||||
actions._select:replace(function(_, cmd)
|
||||
local selection = actions.get_selected_entry()
|
||||
|
||||
actions.close(prompt_bufnr)
|
||||
@@ -483,7 +483,7 @@ internal.reloader = function(opts)
|
||||
sorter = conf.generic_sorter(opts),
|
||||
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
|
||||
actions.close(prompt_bufnr)
|
||||
@@ -562,7 +562,7 @@ internal.colorscheme = function(opts)
|
||||
-- TODO: better preview?
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
|
||||
actions.close(prompt_bufnr)
|
||||
@@ -614,7 +614,7 @@ internal.registers = function(opts)
|
||||
-- use levenshtein as n-gram doesn't support <2 char matches
|
||||
sorter = sorters.get_levenshtein_sorter(),
|
||||
attach_mappings = function(_, map)
|
||||
actions.goto_file_selection_edit:replace(actions.paste_register)
|
||||
actions.select:replace(actions.paste_register)
|
||||
map('i', '<C-e>', actions.edit_register)
|
||||
|
||||
return true
|
||||
@@ -653,7 +653,7 @@ internal.keymaps = function(opts)
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
vim.api.nvim_feedkeys(
|
||||
vim.api.nvim_replace_termcodes(selection.value.lhs, true, false, true),
|
||||
@@ -675,7 +675,7 @@ internal.filetypes = function(opts)
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
vim.cmd('setfiletype ' .. selection[1])
|
||||
@@ -696,7 +696,7 @@ internal.highlights = function(opts)
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
vim.cmd('hi ' .. selection.value)
|
||||
@@ -787,7 +787,7 @@ internal.autocommands = function(opts)
|
||||
previewer = previewers.autocommands.new(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions._goto_file_selection:replace(function(_, vim_cmd)
|
||||
actions._select:replace(function(_, vim_cmd)
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
vim.cmd(vim_cmd .. ' ' .. selection.value)
|
||||
@@ -811,7 +811,7 @@ internal.spell_suggest = function(opts)
|
||||
},
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.goto_file_selection_edit:replace(function()
|
||||
actions.select:replace(function()
|
||||
local selection = actions.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
vim.cmd('normal! ciw' .. selection[1])
|
||||
|
||||
Reference in New Issue
Block a user