summaryrefslogtreecommitdiff
path: root/lua/telescope/actions.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-08-29 22:15:40 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-08-29 22:15:40 -0400
commitae9b76929957a1eb20ea016c6ce9d34bc0d8b213 (patch)
tree4b129c1d53e9df1c7cb663a6bacb9b6dc84605d7 /lua/telescope/actions.lua
parent711536859370510531744f6b239004a67c2e1a7e (diff)
feat: Add selection and start actions
Diffstat (limited to 'lua/telescope/actions.lua')
-rw-r--r--lua/telescope/actions.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/lua/telescope/actions.lua b/lua/telescope/actions.lua
new file mode 100644
index 0000000..a03323b
--- /dev/null
+++ b/lua/telescope/actions.lua
@@ -0,0 +1,25 @@
+-- Actions functions that are useful for people creating their own mappings.
+
+local state = require('telescope.state')
+
+local actions = {}
+
+
+--- Get the current picker object for the prompt
+function actions.get_current_picker(prompt_bufnr)
+ return state.get_status(prompt_bufnr).picker
+end
+
+--- Move the current selection of a picker {change} rows.
+--- Handles not overflowing / underflowing the list.
+function actions.shift_current_selection(prompt_bufnr, change)
+ actions.get_current_picker(prompt_bufnr):move_selection(change)
+end
+
+--- Get the current entry
+function actions.get_selected_entry(prompt_bufnr)
+ return actions.get_current_picker(prompt_bufnr):get_selection()
+end
+
+
+return actions