diff options
| author | fdschmidt93 <39233597+fdschmidt93@users.noreply.github.com> | 2021-07-03 10:54:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-03 10:54:06 +0200 |
| commit | bdd0df73a6ee424f9c77624218b4fba1e42e468c (patch) | |
| tree | bdd5bc7e80d733c11cdba3fb59468a852fc10b9e /doc | |
| parent | c5a6ed16e2022e2d19936e00a8a39a97cba39f11 (diff) | |
feat: select_all, toggle_all and drop_all actions (#931)
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/telescope.txt | 94 |
1 files changed, 93 insertions, 1 deletions
diff --git a/doc/telescope.txt b/doc/telescope.txt index 37f2b8d..b3f0956 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -371,6 +371,34 @@ actions.toggle_selection({prompt_bufnr}) *actions.toggle_selection()* {prompt_bufnr} (number) The prompt bufnr +actions.select_all({prompt_bufnr}) *actions.select_all()* + Multi select all entries. + - Note: selected entries may include results not visible in the results + popup. + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.drop_all({prompt_bufnr}) *actions.drop_all()* + Drop all entries from the current multi selection. + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + +actions.toggle_all({prompt_bufnr}) *actions.toggle_all()* + Toggle multi selection for all entries. + - Note: toggled entries may include results not visible in the results + popup. + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + + actions.git_create_branch({prompt_bufnr}) *actions.git_create_branch()* Create and checkout a new git branch if it doesn't already exist @@ -429,7 +457,7 @@ actions.git_rebase_branch({prompt_bufnr}) *actions.git_rebase_branch()* {prompt_bufnr} (number) The prompt bufnr -actions.git_checkout_current_buffer({prompt_bufnr})*actions.git_checkout_current_buffer()* +actions.git_staging_toggle({prompt_bufnr}) *actions.git_staging_toggle()* Stage/unstage selected file @@ -1196,6 +1224,70 @@ builtin.lsp_workspace_diagnostics({opts})*builtin.lsp_workspace_diagnostics()* ================================================================================ + *telescope.actions.utils* + +Utilities to wrap functions around picker selections and entries. + +Generally used from within other |telescope.actions| + +utils.map_entries({prompt_bufnr}, {f}) *utils.map_entries()* + Apply `f` to the entries of the current picker. + - Notes: + - Mapped entries may include results not visible in the results popup. + - Indices are 1-indexed, whereas rows are 0-indexed. + - Warning: `map_entries` has no return value. + - The below example showcases how to collect results + Usage: + local action_state = require "telescope.actions.state" + local action_utils = require "telescope.actions.utils" + function entry_value_by_row() + local prompt_bufnr = vim.api.nvim_get_current_buf() + local current_picker = action_state.get_current_picker(prompt_bufnr) + local results = {} + action_utils.map_entries(prompt_bufnr, function(entry, index, row) + results[row] = entry.value + end) + return results + end + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + {f} (function) Function to map onto entries of picker that + takes (entry, index, row) as viable + arguments + + +utils.map_selections({prompt_bufnr}, {f}) *utils.map_selections()* + Apply `f` to the multi selections of the current picker and return a table + of mapped selections. + - Notes: + - Mapped selections may include results not visible in the results popup. + - Selected entries are returned in order of their selection. + - Warning: `map_selections` has no return value. + - The below example showcases how to collect results + Usage: + local action_state = require "telescope.actions.state" + local action_utils = require "telescope.actions.utils" + function selection_by_index() + local prompt_bufnr = vim.api.nvim_get_current_buf() + local current_picker = action_state.get_current_picker(prompt_bufnr) + local results = {} + action_utils.map_selections(prompt_bufnr, function(entry, index) + results[index] = entry.value + end) + return results + end + + + Parameters: ~ + {prompt_bufnr} (number) The prompt bufnr + {f} (function) Function to map onto selection of picker + that takes (selection) as a viable argument + + + +================================================================================ *telescope.actions.state* Functions to be used to determine the current state of telescope. |
