docs: rewrite readme and add missing config values + builtin opts

This commit is contained in:
Simon Hauser
2021-09-13 22:03:41 +02:00
parent aaffa84ebb
commit 5131df7df1
17 changed files with 1822 additions and 1165 deletions

View File

@@ -16,20 +16,21 @@ local utils = {}
--- - Indices are 1-indexed, whereas rows are 0-indexed.
--- - Warning: `map_entries` has no return value.
--- - The below example showcases how to collect results
--- <pre>
---
--- 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
--- </pre>
--- <code>
--- 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
--- </code>
---@param prompt_bufnr number: The prompt bufnr
---@param f function: Function to map onto entries of picker that takes (entry, index, row) as viable arguments
function utils.map_entries(prompt_bufnr, f)
@@ -52,20 +53,21 @@ end
--- - Selected entries are returned in order of their selection.
--- - Warning: `map_selections` has no return value.
--- - The below example showcases how to collect results
--- <pre>
---
--- 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
--- </pre>
--- <code>
--- 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
--- </code>
---@param prompt_bufnr number: The prompt bufnr
---@param f function: Function to map onto selection of picker that takes (selection) as a viable argument
function utils.map_selections(prompt_bufnr, f)