Files
telescope.nvim/lua/telescope/actions/state.lua
T
TJ DeVries 1e22605f09 wip: Modify action and action_set signatures
Now you can pass the entry that you want to take the action on for both
actions and action sets. This is part 1 of being able to do things like
taking actions on multiple entries, but only writing code for one :)
2021-04-28 12:43:30 -04:00

39 lines
861 B
Lua

---@tag telescope.actions.state
---@brief [[
--- Functions to be used to determine the current state of telescope.
---
--- Generally used from within other |telescope.actions|
---@brief ]]
local global_state = require('telescope.state')
local action_state = {}
--- Get the current entry
function action_state.get_selected_entry()
return global_state.get_global_key('selected_entry')
end
--- Gets the current line
function action_state.get_current_line()
return global_state.get_global_key('current_line')
end
--- Gets the current picker
function action_state.get_current_picker()
return global_state.get_current_picker()
end
local select_to_edit_map = {
default = "edit",
horizontal = "new",
vertical = "vnew",
tab = "tabedit",
}
function action_state.select_key_to_edit_key(type)
return select_to_edit_map[type]
end
return action_state