Files
telescope.nvim/lua/telescope/actions/state.lua
TJ DeVries c6980a9acf docs: add other actions modules (#792)
* docs: add other actions modules

* [docgen] Update doc/telescope.txt
skip-checks: true

* fixup

* [docgen] Update doc/telescope.txt
skip-checks: true

Co-authored-by: Github Actions <actions@github>
2021-04-22 17:08:22 -04:00

40 lines
932 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
---@param prompt_bufnr number: The prompt bufnr
function action_state.get_current_picker(prompt_bufnr)
return global_state.get_status(prompt_bufnr).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