docs: proof-read edits (#2311)
This commit is contained in:
@@ -6,9 +6,9 @@ filter, find and pick things in Lua.
|
|||||||
|
|
||||||
Getting started with telescope:
|
Getting started with telescope:
|
||||||
1. Run `:checkhealth telescope` to make sure everything is installed.
|
1. Run `:checkhealth telescope` to make sure everything is installed.
|
||||||
2. Evaluate it working with `:Telescope find_files` or `:lua
|
2. Evaluate it is working with `:Telescope find_files` or `:lua
|
||||||
require("telescope.builtin").find_files()`
|
require("telescope.builtin").find_files()`
|
||||||
3. Put a `require("telescope").setup() call somewhere in your neovim config.
|
3. Put a `require("telescope").setup()` call somewhere in your neovim config.
|
||||||
4. Read |telescope.setup| to check what config keys are available and what
|
4. Read |telescope.setup| to check what config keys are available and what
|
||||||
you can put inside the setup call
|
you can put inside the setup call
|
||||||
5. Read |telescope.builtin| to check which builtin pickers are offered and
|
5. Read |telescope.builtin| to check which builtin pickers are offered and
|
||||||
@@ -24,14 +24,14 @@ The below flow chart illustrates a simplified telescope architecture:
|
|||||||
│ │ ┌───│Manager│────│ Sorter │┐ └───┬───* │
|
│ │ ┌───│Manager│────│ Sorter │┐ └───┬───* │
|
||||||
│ ▼ ▼ └───────* └────────┘│ │ │
|
│ ▼ ▼ └───────* └────────┘│ │ │
|
||||||
│ 1────────┐ 2───┴──┐ │ │
|
│ 1────────┐ 2───┴──┐ │ │
|
||||||
│ ┌─────│ Picker │ │Finder│◄────┘ │
|
│ ┌─────│ Picker │ │Finder│◀────┘ │
|
||||||
│ ▼ └───┬────┘ └──────* │
|
│ ▼ └───┬────┘ └──────* │
|
||||||
│ ┌────────┐ │ 3────────+ ▲ │
|
│ ┌────────┐ │ 3────────+ ▲ │
|
||||||
│ │Selected│ └───────│ Prompt │─────────┘ │
|
│ │Selected│ └───────│ Prompt │─────────┘ │
|
||||||
│ │ Entry │ └───┬────┘ │
|
│ │ Entry │ └───┬────┘ │
|
||||||
│ └────────* ┌───┴────┐ ┌────────┐ ┌────────┐ │
|
│ └────────* ┌───┴────┐ ┌────────┐ ┌────────┐ │
|
||||||
│ │ ▲ 4─────────┐│ Prompt │ │(Attach)│ │Actions │ │
|
│ │ ▲ 4─────────┐│ Prompt │ │(Attach)│ │Actions │ │
|
||||||
│ ▼ └──► │ Results ││ Buffer │◄─┤Mappings│◄─┤User Fn │ │
|
│ ▼ └──▶ │ Results ││ Buffer │◀─┤Mappings│◀─┤User Fn │ │
|
||||||
│5─────────┐ └─────────┘└────────┘ └────────┘ └────────┘ │
|
│5─────────┐ └─────────┘└────────┘ └────────┘ └────────┘ │
|
||||||
││Previewer│ │
|
││Previewer│ │
|
||||||
│└─────────┘ telescope.nvim architecture │
|
│└─────────┘ telescope.nvim architecture │
|
||||||
@@ -196,9 +196,9 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
and `actions.layout.cycle_layout_prev`.
|
and `actions.layout.cycle_layout_prev`.
|
||||||
Should be a list of "layout setups".
|
Should be a list of "layout setups".
|
||||||
Each "layout setup" can take one of two forms:
|
Each "layout setup" can take one of two forms:
|
||||||
1. string <br>
|
1. string
|
||||||
This is interpreted as the name of a `layout_strategy`
|
This is interpreted as the name of a `layout_strategy`
|
||||||
2. table <br>
|
2. table
|
||||||
A table with possible keys `layout_strategy`, `layout_config` and `previewer`
|
A table with possible keys `layout_strategy`, `layout_config` and `previewer`
|
||||||
|
|
||||||
Default: { "horizontal", "vertical" }
|
Default: { "horizontal", "vertical" }
|
||||||
@@ -227,7 +227,6 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
selection_caret: ~
|
selection_caret: ~
|
||||||
The character(s) that will be shown in front of the current selection.
|
The character(s) that will be shown in front of the current selection.
|
||||||
|
|
||||||
|
|
||||||
Default: '> '
|
Default: '> '
|
||||||
|
|
||||||
*telescope.defaults.entry_prefix*
|
*telescope.defaults.entry_prefix*
|
||||||
@@ -260,7 +259,7 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
|
|
||||||
*telescope.defaults.path_display*
|
*telescope.defaults.path_display*
|
||||||
path_display: ~
|
path_display: ~
|
||||||
Determines how file paths are displayed
|
Determines how file paths are displayed.
|
||||||
|
|
||||||
path_display can be set to an array with a combination of:
|
path_display can be set to an array with a combination of:
|
||||||
- "hidden" hide file names
|
- "hidden" hide file names
|
||||||
@@ -273,7 +272,7 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
- "shorten" only display the first character of each directory in
|
- "shorten" only display the first character of each directory in
|
||||||
the path
|
the path
|
||||||
- "truncate" truncates the start of the path when the whole path will
|
- "truncate" truncates the start of the path when the whole path will
|
||||||
not fit. To increase the the gap between the path and the edge.
|
not fit. To increase the gap between the path and the edge,
|
||||||
set truncate to number `truncate = 3`
|
set truncate to number `truncate = 3`
|
||||||
|
|
||||||
You can also specify the number of characters of each directory name
|
You can also specify the number of characters of each directory name
|
||||||
@@ -352,7 +351,7 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
prompt_title: ~
|
prompt_title: ~
|
||||||
Defines the default title of the prompt window. A false value
|
Defines the default title of the prompt window. A false value
|
||||||
can be used to hide the title altogether. Most of the times builtins
|
can be used to hide the title altogether. Most of the times builtins
|
||||||
define a prompt_title which will be prefered over this default.
|
define a prompt_title which will be preferred over this default.
|
||||||
|
|
||||||
Default: "Prompt"
|
Default: "Prompt"
|
||||||
|
|
||||||
@@ -371,6 +370,8 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
Will allow you to completely remove all of telescope's default maps
|
Will allow you to completely remove all of telescope's default maps
|
||||||
and use your own.
|
and use your own.
|
||||||
|
|
||||||
|
Default: nil
|
||||||
|
|
||||||
|
|
||||||
*telescope.defaults.history*
|
*telescope.defaults.history*
|
||||||
history: ~
|
history: ~
|
||||||
@@ -388,11 +389,11 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
|
|
||||||
Fields:
|
Fields:
|
||||||
- path: The path to the telescope history as string.
|
- path: The path to the telescope history as string.
|
||||||
default: stdpath("data")/telescope_history
|
Default: stdpath("data")/telescope_history
|
||||||
- limit: The amount of entries that will be written in the
|
- limit: The amount of entries that will be written in the
|
||||||
history.
|
history.
|
||||||
Warning: If limit is set to nil it will grow unbound.
|
Warning: If limit is set to nil it will grow unbound.
|
||||||
default: 100
|
Default: 100
|
||||||
- handler: A lua function that implements the history.
|
- handler: A lua function that implements the history.
|
||||||
This is meant as a developer setting for extensions to
|
This is meant as a developer setting for extensions to
|
||||||
override the history handling, e.g.,
|
override the history handling, e.g.,
|
||||||
@@ -566,7 +567,7 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
file_sorter: ~
|
file_sorter: ~
|
||||||
A function pointer that specifies the file_sorter. This sorter will
|
A function pointer that specifies the file_sorter. This sorter will
|
||||||
be used for find_files, git_files and similar.
|
be used for find_files, git_files and similar.
|
||||||
Hint: If you load a native sorter, you dont need to change this value,
|
Hint: If you load a native sorter, you don't need to change this value,
|
||||||
the native sorter will override it anyway.
|
the native sorter will override it anyway.
|
||||||
|
|
||||||
Default: require("telescope.sorters").get_fzy_sorter
|
Default: require("telescope.sorters").get_fzy_sorter
|
||||||
@@ -575,7 +576,7 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
generic_sorter: ~
|
generic_sorter: ~
|
||||||
A function pointer to the generic sorter. The sorter that should be
|
A function pointer to the generic sorter. The sorter that should be
|
||||||
used for everything that is not a file.
|
used for everything that is not a file.
|
||||||
Hint: If you load a native sorter, you dont need to change this value,
|
Hint: If you load a native sorter, you don't need to change this value,
|
||||||
the native sorter will override it anyway.
|
the native sorter will override it anyway.
|
||||||
|
|
||||||
Default: require("telescope.sorters").get_fzy_sorter
|
Default: require("telescope.sorters").get_fzy_sorter
|
||||||
@@ -584,7 +585,7 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
prefilter_sorter: ~
|
prefilter_sorter: ~
|
||||||
This points to a wrapper sorter around the generic_sorter that is able
|
This points to a wrapper sorter around the generic_sorter that is able
|
||||||
to do prefiltering.
|
to do prefiltering.
|
||||||
Its usually used for lsp_*_symbols and lsp_*_diagnostics
|
It's usually used for lsp_*_symbols and lsp_*_diagnostics
|
||||||
|
|
||||||
Default: require("telescope.sorters").prefilter
|
Default: require("telescope.sorters").prefilter
|
||||||
|
|
||||||
@@ -896,7 +897,7 @@ builtin.current_buffer_fuzzy_find({opts}) *telescope.builtin.current_buffer_fuzz
|
|||||||
{opts} (table) options to pass to the picker
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{skip_empty_lines} (boolean) if true we dont display empty lines
|
{skip_empty_lines} (boolean) if true we don't display empty lines
|
||||||
(default: false)
|
(default: false)
|
||||||
|
|
||||||
|
|
||||||
@@ -965,7 +966,7 @@ builtin.git_files({opts}) *telescope.builtin.git_files()*
|
|||||||
{recurse_submodules} (boolean) if true, adds the
|
{recurse_submodules} (boolean) if true, adds the
|
||||||
`--recurse-submodules` flag to command
|
`--recurse-submodules` flag to command
|
||||||
(default: false)
|
(default: false)
|
||||||
{git_command} (table) command that will be exectued.
|
{git_command} (table) command that will be executed.
|
||||||
{"git","ls-files","--exclude-standard","--cached"}
|
{"git","ls-files","--exclude-standard","--cached"}
|
||||||
|
|
||||||
|
|
||||||
@@ -985,13 +986,13 @@ builtin.git_commits({opts}) *telescope.builtin.git_commits()*
|
|||||||
{cwd} (string) specify the path of the repo
|
{cwd} (string) specify the path of the repo
|
||||||
{use_git_root} (boolean) if we should use git root as cwd or the cwd
|
{use_git_root} (boolean) if we should use git root as cwd or the cwd
|
||||||
(important for submodule) (default: true)
|
(important for submodule) (default: true)
|
||||||
{git_command} (table) command that will be exectued.
|
{git_command} (table) command that will be executed.
|
||||||
{"git","log","--pretty=oneline","--abbrev-commit","--","."}
|
{"git","log","--pretty=oneline","--abbrev-commit","--","."}
|
||||||
|
|
||||||
|
|
||||||
builtin.git_bcommits({opts}) *telescope.builtin.git_bcommits()*
|
builtin.git_bcommits({opts}) *telescope.builtin.git_bcommits()*
|
||||||
Lists commits for current buffer with diff preview
|
Lists commits for current buffer with diff preview
|
||||||
- Default keymaps or your overriden `select_` keys:
|
- Default keymaps or your overridden `select_` keys:
|
||||||
- `<cr>`: checks out the currently selected commit
|
- `<cr>`: checks out the currently selected commit
|
||||||
- `<c-v>`: opens a diff in a vertical split
|
- `<c-v>`: opens a diff in a vertical split
|
||||||
- `<c-x>`: opens a diff in a horizontal split
|
- `<c-x>`: opens a diff in a horizontal split
|
||||||
@@ -1007,7 +1008,7 @@ builtin.git_bcommits({opts}) *telescope.builtin.git_bcommits()*
|
|||||||
(important for submodule) (default: true)
|
(important for submodule) (default: true)
|
||||||
{current_file} (string) specify the current file that should be used
|
{current_file} (string) specify the current file that should be used
|
||||||
for bcommits (default: current buffer)
|
for bcommits (default: current buffer)
|
||||||
{git_command} (table) command that will be exectued.
|
{git_command} (table) command that will be executed.
|
||||||
{"git","log","--pretty=oneline","--abbrev-commit"}
|
{"git","log","--pretty=oneline","--abbrev-commit"}
|
||||||
|
|
||||||
|
|
||||||
@@ -1129,9 +1130,9 @@ builtin.planets({opts}) *telescope.builtin.planets()*
|
|||||||
{opts} (table) options to pass to the picker
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{show_pluto} (boolean) we love pluto (default: false, because its a
|
{show_pluto} (boolean) we love Pluto (default: false, because its a
|
||||||
hidden feature)
|
hidden feature)
|
||||||
{show_moon} (boolean) we love the moon (default: false, because its
|
{show_moon} (boolean) we love the Moon (default: false, because its
|
||||||
a hidden feature)
|
a hidden feature)
|
||||||
|
|
||||||
|
|
||||||
@@ -1654,9 +1655,10 @@ themes.get_dropdown() *telescope.themes.get_dropdown()*
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
>
|
>
|
||||||
`local builtin = require('telescope.builtin')`
|
local opts = {...} -- picker options
|
||||||
`local themes = require('telescope.themes')`
|
local builtin = require('telescope.builtin')
|
||||||
`builtin.find_files(themes.get_dropdown())`
|
local themes = require('telescope.themes')
|
||||||
|
builtin.find_files(themes.get_dropdown(opts))
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
@@ -1666,10 +1668,10 @@ themes.get_cursor() *telescope.themes.get_cursor()*
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
>
|
>
|
||||||
|
local opts = {...} -- picker options
|
||||||
`local builtin = require('telescope.builtin')`
|
local builtin = require('telescope.builtin')
|
||||||
`local themes = require('telescope.themes')`
|
local themes = require('telescope.themes')
|
||||||
`builtin.lsp_references(themes.get_cursor())`
|
builtin.find_files(themes.get_cursor(opts))
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
@@ -1679,9 +1681,10 @@ themes.get_ivy() *telescope.themes.get_ivy()*
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
>
|
>
|
||||||
`local builtin = require('telescope.builtin')`
|
local opts = {...} -- picker options
|
||||||
`local themes = require('telescope.themes')`
|
local builtin = require('telescope.builtin')
|
||||||
`builtin.find_files(themes.get_ivy())`
|
local themes = require('telescope.themes')
|
||||||
|
builtin.find_files(themes.get_ivy(opts))
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
@@ -1691,12 +1694,11 @@ themes.get_ivy() *telescope.themes.get_ivy()*
|
|||||||
MAPPINGS *telescope.mappings*
|
MAPPINGS *telescope.mappings*
|
||||||
|
|
||||||
|telescope.mappings| is used to configure the keybindings within a telescope
|
|telescope.mappings| is used to configure the keybindings within a telescope
|
||||||
picker. These keybinds are only local to the picker window and will be cleared
|
picker. These key binds are only local to the picker window and will be cleared
|
||||||
once you exit the picker.
|
once you exit the picker.
|
||||||
|
|
||||||
We provide multiple different ways of configuring, as described below, to
|
We provide multiple configuration options to make it easy for you to adjust
|
||||||
provide an easy to use experience for changing the default behavior of
|
telescope's default key bindings and create your own custom key binds.
|
||||||
telescope or extending for your own purposes.
|
|
||||||
|
|
||||||
To see many of the builtin actions that you can use as values for this table,
|
To see many of the builtin actions that you can use as values for this table,
|
||||||
see |telescope.actions|
|
see |telescope.actions|
|
||||||
@@ -1729,7 +1731,6 @@ For example:
|
|||||||
...,
|
...,
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
Into your config.
|
|
||||||
|
|
||||||
To override behavior of a key, simply set the value to be a function (either by
|
To override behavior of a key, simply set the value to be a function (either by
|
||||||
requiring an action or by writing your own function)
|
requiring an action or by writing your own function)
|
||||||
@@ -1742,7 +1743,8 @@ requiring an action or by writing your own function)
|
|||||||
<
|
<
|
||||||
|
|
||||||
If the function you want is part of `telescope.actions`, then you can simply
|
If the function you want is part of `telescope.actions`, then you can simply
|
||||||
give a string. For example, the previous option is equivalent to:
|
supply the function name as a string. For example, the previous option is
|
||||||
|
equivalent to:
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
...,
|
...,
|
||||||
@@ -1854,7 +1856,6 @@ All layout strategies are functions with the following signature:
|
|||||||
- lines : (number) Lines in the vim window
|
- lines : (number) Lines in the vim window
|
||||||
- layout_config : (table) The configuration values specific to the picker.
|
- layout_config : (table) The configuration values specific to the picker.
|
||||||
|
|
||||||
|
|
||||||
This means you can create your own layout strategy if you want! Just be aware
|
This means you can create your own layout strategy if you want! Just be aware
|
||||||
for now that we may change some APIs or interfaces, so they may break if you
|
for now that we may change some APIs or interfaces, so they may break if you
|
||||||
create your own.
|
create your own.
|
||||||
@@ -1979,6 +1980,20 @@ layout_strategies.cursor() *telescope.layout.cursor()*
|
|||||||
│ │
|
│ │
|
||||||
└──────────────────────────────────────────────────┘
|
└──────────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
`picker.layout_config` shared options:
|
||||||
|
- height:
|
||||||
|
- How tall to make Telescope's entire layout
|
||||||
|
- See |resolver.resolve_height()|
|
||||||
|
- scroll_speed: The number of lines to scroll through the previewer
|
||||||
|
- width:
|
||||||
|
- How wide to make Telescope's entire layout
|
||||||
|
- See |resolver.resolve_width()|
|
||||||
|
|
||||||
|
`picker.layout_config` unique options:
|
||||||
|
- preview_cutoff: When columns are less than this value, the preview will be disabled
|
||||||
|
- preview_width:
|
||||||
|
- Change the width of Telescope's preview window
|
||||||
|
- See |resolver.resolve_width()|
|
||||||
|
|
||||||
|
|
||||||
layout_strategies.vertical() *telescope.layout.vertical()*
|
layout_strategies.vertical() *telescope.layout.vertical()*
|
||||||
@@ -2141,24 +2156,23 @@ Every entry maker returns a function that accepts the data to be used for an
|
|||||||
entry. This function will return an entry table (or nil, meaning skip this
|
entry. This function will return an entry table (or nil, meaning skip this
|
||||||
entry) which contains the following important keys:
|
entry) which contains the following important keys:
|
||||||
- value any: value key can be anything but still required
|
- value any: value key can be anything but still required
|
||||||
- valid bool: is an optional key because it defaults to true but if the key is
|
- valid bool (optional): is an optional key because it defaults to true but if
|
||||||
set to false it will not be displayed by the picker (optional)
|
the key is set to false it will not be displayed by the picker
|
||||||
- ordinal string: is the text that is used for filtering (required)
|
- ordinal string: is the text that is used for filtering
|
||||||
- display string|function: is either a string of the text that is being
|
- display string|function: is either a string of the text that is being
|
||||||
displayed or a function receiving the entry at a later stage, when the entry
|
displayed or a function receiving the entry at a later stage, when the entry
|
||||||
is actually being displayed. A function can be useful here if a complex
|
is actually being displayed. A function can be useful here if a complex
|
||||||
calculation has to be done. `make_entry` can also return a second value a
|
calculation has to be done. `make_entry` can also return a second value - a
|
||||||
highlight array which will then apply to the line. Highlight entry in this
|
highlight array which will then apply to the line. Highlight entry in this
|
||||||
array has the following signature `{ { start_col, end_col }, hl_group }`
|
array has the following signature `{ { start_col, end_col }, hl_group }`
|
||||||
(required)
|
- filename string (optional): will be interpreted by the default `<cr>` action
|
||||||
- filename string: will be interpreted by the default `<cr>` action as open
|
as open this file
|
||||||
this file (optional)
|
- bufnr number (optional): will be interpreted by the default `<cr>` action as
|
||||||
- bufnr number: will be interpreted by the default `<cr>` action as open this
|
open this buffer
|
||||||
buffer (optional)
|
- lnum number (optional): lnum value which will be interpreted by the default
|
||||||
- lnum number: lnum value which will be interpreted by the default `<cr>`
|
`<cr>` action as a jump to this line
|
||||||
action as a jump to this line (optional)
|
- col number (optional): col value which will be interpreted by the default
|
||||||
- col number: col value which will be interpreted by the default `<cr>` action
|
`<cr>` action as a jump to this column
|
||||||
as a jump to this column (optional)
|
|
||||||
|
|
||||||
For more information on easier displaying, see
|
For more information on easier displaying, see
|
||||||
|telescope.pickers.entry_display|
|
|telescope.pickers.entry_display|
|
||||||
@@ -2180,7 +2194,7 @@ every single entry. So it is suggested to do this outside of `make_display` for
|
|||||||
the best performance.
|
the best performance.
|
||||||
|
|
||||||
The create function will use the column widths passed to it in
|
The create function will use the column widths passed to it in
|
||||||
configaration.items. Each item in that table is the number of characters in the
|
configuration.items. Each item in that table is the number of characters in the
|
||||||
column. It's also possible for the final column to not have a fixed width, this
|
column. It's also possible for the final column to not have a fixed width, this
|
||||||
will be shown in the configuration as 'remaining = true'.
|
will be shown in the configuration as 'remaining = true'.
|
||||||
|
|
||||||
@@ -2243,7 +2257,7 @@ utils.transform_path({opts}, {path}) *telescope.utils.transform_path()*
|
|||||||
Parameters: ~
|
Parameters: ~
|
||||||
{opts} (table) The opts the users passed into the picker. Might
|
{opts} (table) The opts the users passed into the picker. Might
|
||||||
contains a path_display key
|
contains a path_display key
|
||||||
{path} (string) The path that should be formated
|
{path} (string) The path that should be formatted
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
string: The transformed path ready to be displayed
|
string: The transformed path ready to be displayed
|
||||||
@@ -2262,9 +2276,9 @@ utils.notify({funname}, {opts}) *telescope.utils.notify()*
|
|||||||
================================================================================
|
================================================================================
|
||||||
ACTIONS *telescope.actions*
|
ACTIONS *telescope.actions*
|
||||||
|
|
||||||
Actions functions that are useful for people creating their own mappings.
|
These functions are useful for people creating their own mappings.
|
||||||
|
|
||||||
Actions can be either normal functions that expect the prompt_bufnr as first
|
Actions can be either normal functions that expect the `prompt_bufnr` as first
|
||||||
argument (1) or they can be a custom telescope type called "action" (2).
|
argument (1) or they can be a custom telescope type called "action" (2).
|
||||||
|
|
||||||
(1) The `prompt_bufnr` of a normal function denotes the identifier of your
|
(1) The `prompt_bufnr` of a normal function denotes the identifier of your
|
||||||
@@ -2305,8 +2319,8 @@ do the following:
|
|||||||
action(bufnr)
|
action(bufnr)
|
||||||
<
|
<
|
||||||
|
|
||||||
Another interesing thing to do is that these actions now have functions you can
|
Another interesting thing to do is that these actions now have functions you
|
||||||
call. These functions include `:replace(f)`, `:replace_if(f, c)`,
|
can call. These functions include `:replace(f)`, `:replace_if(f, c)`,
|
||||||
`replace_map(tbl)` and `enhance(tbl)`. More information on these functions can
|
`replace_map(tbl)` and `enhance(tbl)`. More information on these functions can
|
||||||
be found in the `developers.md` and `lua/tests/automated/action_spec.lua` file.
|
be found in the `developers.md` and `lua/tests/automated/action_spec.lua` file.
|
||||||
|
|
||||||
@@ -2392,8 +2406,8 @@ actions.toggle_selection({prompt_bufnr}) *telescope.actions.toggle_selection()*
|
|||||||
|
|
||||||
actions.select_all({prompt_bufnr}) *telescope.actions.select_all()*
|
actions.select_all({prompt_bufnr}) *telescope.actions.select_all()*
|
||||||
Multi select all entries.
|
Multi select all entries.
|
||||||
- Note: selected entries may include results not visible in the results
|
- Note: selected entries may include results not visible in the results pop
|
||||||
popup.
|
up.
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@@ -2410,8 +2424,8 @@ actions.drop_all({prompt_bufnr}) *telescope.actions.drop_all()*
|
|||||||
|
|
||||||
actions.toggle_all({prompt_bufnr}) *telescope.actions.toggle_all()*
|
actions.toggle_all({prompt_bufnr}) *telescope.actions.toggle_all()*
|
||||||
Toggle multi selection for all entries.
|
Toggle multi selection for all entries.
|
||||||
- Note: toggled entries may include results not visible in the results
|
- Note: toggled entries may include results not visible in the results pop
|
||||||
popup.
|
up.
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@@ -2580,7 +2594,7 @@ actions._close({prompt_bufnr}) *telescope.actions._close()*
|
|||||||
|
|
||||||
|
|
||||||
actions.edit_command_line({prompt_bufnr}) *telescope.actions.edit_command_line()*
|
actions.edit_command_line({prompt_bufnr}) *telescope.actions.edit_command_line()*
|
||||||
Set a value in the command line and dont run it, making it editable.
|
Set a value in the command line and don't run it, making it editable.
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@@ -2596,7 +2610,7 @@ actions.set_command_line({prompt_bufnr}) *telescope.actions.set_command_line()*
|
|||||||
|
|
||||||
|
|
||||||
actions.edit_search_line({prompt_bufnr}) *telescope.actions.edit_search_line()*
|
actions.edit_search_line({prompt_bufnr}) *telescope.actions.edit_search_line()*
|
||||||
Set a value in the search line and dont search for it, making it editable.
|
Set a value in the search line and don't search for it, making it editable.
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@@ -3120,7 +3134,7 @@ utils.map_entries({prompt_bufnr}, {f}) *telescope.actions.utils.map_entries()*
|
|||||||
Apply `f` to the entries of the current picker.
|
Apply `f` to the entries of the current picker.
|
||||||
- Notes:
|
- Notes:
|
||||||
- Mapped entries include all currently filtered results, not just the
|
- Mapped entries include all currently filtered results, not just the
|
||||||
visible onces.
|
visible ones.
|
||||||
- Indices are 1-indexed, whereas rows are 0-indexed.
|
- Indices are 1-indexed, whereas rows are 0-indexed.
|
||||||
- Warning: `map_entries` has no return value.
|
- Warning: `map_entries` has no return value.
|
||||||
- The below example showcases how to collect results
|
- The below example showcases how to collect results
|
||||||
@@ -3152,7 +3166,8 @@ utils.map_selections({prompt_bufnr}, {f}) *telescope.actions.utils.map_selection
|
|||||||
Apply `f` to the multi selections of the current picker and return a table
|
Apply `f` to the multi selections of the current picker and return a table
|
||||||
of mapped selections.
|
of mapped selections.
|
||||||
- Notes:
|
- Notes:
|
||||||
- Mapped selections may include results not visible in the results popup.
|
- Mapped selections may include results not visible in the results pop
|
||||||
|
up.
|
||||||
- Selected entries are returned in order of their selection.
|
- Selected entries are returned in order of their selection.
|
||||||
- Warning: `map_selections` has no return value.
|
- Warning: `map_selections` has no return value.
|
||||||
- The below example showcases how to collect results
|
- The below example showcases how to collect results
|
||||||
@@ -3483,8 +3498,8 @@ previewers.new_buffer_previewer() *telescope.previewers.new_buffer_previewer()*
|
|||||||
vim.api.nvim_buf_call(bufnr, function()
|
vim.api.nvim_buf_call(bufnr, function()
|
||||||
-- for example `search` and `matchadd`
|
-- for example `search` and `matchadd`
|
||||||
end)
|
end)
|
||||||
to achieve that.
|
|
||||||
<
|
<
|
||||||
|
to achieve that.
|
||||||
- If you want to read a file into the buffer it's best to use
|
- If you want to read a file into the buffer it's best to use
|
||||||
`buffer_previewer_maker`. But access this function with
|
`buffer_previewer_maker`. But access this function with
|
||||||
`require('telescope.config').values.buffer_previewer_maker` because it
|
`require('telescope.config').values.buffer_previewer_maker` because it
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
---@config { ["module"] = "telescope.actions" }
|
---@config { ["module"] = "telescope.actions" }
|
||||||
|
|
||||||
---@brief [[
|
---@brief [[
|
||||||
--- Actions functions that are useful for people creating their own mappings.
|
--- These functions are useful for people creating their own mappings.
|
||||||
---
|
---
|
||||||
--- Actions can be either normal functions that expect the prompt_bufnr as
|
--- Actions can be either normal functions that expect the `prompt_bufnr` as
|
||||||
--- first argument (1) or they can be a custom telescope type called "action" (2).
|
--- first argument (1) or they can be a custom telescope type called "action" (2).
|
||||||
---
|
---
|
||||||
--- (1) The `prompt_bufnr` of a normal function denotes the identifier of your
|
--- (1) The `prompt_bufnr` of a normal function denotes the identifier of your
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
--- action(bufnr)
|
--- action(bufnr)
|
||||||
--- </code>
|
--- </code>
|
||||||
---
|
---
|
||||||
--- Another interesing thing to do is that these actions now have functions you
|
--- Another interesting thing to do is that these actions now have functions you
|
||||||
--- can call. These functions include `:replace(f)`, `:replace_if(f, c)`,
|
--- can call. These functions include `:replace(f)`, `:replace_if(f, c)`,
|
||||||
--- `replace_map(tbl)` and `enhance(tbl)`. More information on these functions
|
--- `replace_map(tbl)` and `enhance(tbl)`. More information on these functions
|
||||||
--- can be found in the `developers.md` and `lua/tests/automated/action_spec.lua`
|
--- can be found in the `developers.md` and `lua/tests/automated/action_spec.lua`
|
||||||
@@ -150,7 +150,7 @@ actions.toggle_selection = function(prompt_bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Multi select all entries.
|
--- Multi select all entries.
|
||||||
--- - Note: selected entries may include results not visible in the results popup.
|
--- - Note: selected entries may include results not visible in the results pop up.
|
||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.select_all = function(prompt_bufnr)
|
actions.select_all = function(prompt_bufnr)
|
||||||
local current_picker = action_state.get_current_picker(prompt_bufnr)
|
local current_picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
@@ -187,7 +187,7 @@ actions.drop_all = function(prompt_bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Toggle multi selection for all entries.
|
--- Toggle multi selection for all entries.
|
||||||
--- - Note: toggled entries may include results not visible in the results popup.
|
--- - Note: toggled entries may include results not visible in the results pop up.
|
||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.toggle_all = function(prompt_bufnr)
|
actions.toggle_all = function(prompt_bufnr)
|
||||||
local current_picker = action_state.get_current_picker(prompt_bufnr)
|
local current_picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
@@ -403,7 +403,7 @@ local set_edit_line = function(prompt_bufnr, fname, prefix, postfix)
|
|||||||
a.nvim_feedkeys(a.nvim_replace_termcodes(prefix .. selection.value .. postfix, true, false, true), "t", true)
|
a.nvim_feedkeys(a.nvim_replace_termcodes(prefix .. selection.value .. postfix, true, false, true), "t", true)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set a value in the command line and dont run it, making it editable.
|
--- Set a value in the command line and don't run it, making it editable.
|
||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.edit_command_line = function(prompt_bufnr)
|
actions.edit_command_line = function(prompt_bufnr)
|
||||||
set_edit_line(prompt_bufnr, "actions.edit_command_line", ":")
|
set_edit_line(prompt_bufnr, "actions.edit_command_line", ":")
|
||||||
@@ -422,7 +422,7 @@ actions.set_command_line = function(prompt_bufnr)
|
|||||||
vim.cmd(selection.value)
|
vim.cmd(selection.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set a value in the search line and dont search for it, making it editable.
|
--- Set a value in the search line and don't search for it, making it editable.
|
||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.edit_search_line = function(prompt_bufnr)
|
actions.edit_search_line = function(prompt_bufnr)
|
||||||
set_edit_line(prompt_bufnr, "actions.edit_search_line", "/")
|
set_edit_line(prompt_bufnr, "actions.edit_search_line", "/")
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ local utils = {}
|
|||||||
|
|
||||||
--- Apply `f` to the entries of the current picker.
|
--- Apply `f` to the entries of the current picker.
|
||||||
--- - Notes:
|
--- - Notes:
|
||||||
--- - Mapped entries include all currently filtered results, not just the visible onces.
|
--- - Mapped entries include all currently filtered results, not just the visible ones.
|
||||||
--- - Indices are 1-indexed, whereas rows are 0-indexed.
|
--- - Indices are 1-indexed, whereas rows are 0-indexed.
|
||||||
--- - Warning: `map_entries` has no return value.
|
--- - Warning: `map_entries` has no return value.
|
||||||
--- - The below example showcases how to collect results
|
--- - The below example showcases how to collect results
|
||||||
@@ -50,7 +50,7 @@ end
|
|||||||
|
|
||||||
--- Apply `f` to the multi selections of the current picker and return a table of mapped selections.
|
--- Apply `f` to the multi selections of the current picker and return a table of mapped selections.
|
||||||
--- - Notes:
|
--- - Notes:
|
||||||
--- - Mapped selections may include results not visible in the results popup.
|
--- - Mapped selections may include results not visible in the results pop up.
|
||||||
--- - Selected entries are returned in order of their selection.
|
--- - Selected entries are returned in order of their selection.
|
||||||
--- - Warning: `map_selections` has no return value.
|
--- - Warning: `map_selections` has no return value.
|
||||||
--- - The below example showcases how to collect results
|
--- - The below example showcases how to collect results
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ builtin.treesitter = require_on_exported_call("telescope.builtin.__files").trees
|
|||||||
|
|
||||||
--- Live fuzzy search inside of the currently open buffer
|
--- Live fuzzy search inside of the currently open buffer
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field skip_empty_lines boolean: if true we dont display empty lines (default: false)
|
---@field skip_empty_lines boolean: if true we don't display empty lines (default: false)
|
||||||
builtin.current_buffer_fuzzy_find = require_on_exported_call("telescope.builtin.__files").current_buffer_fuzzy_find
|
builtin.current_buffer_fuzzy_find = require_on_exported_call("telescope.builtin.__files").current_buffer_fuzzy_find
|
||||||
|
|
||||||
--- Lists tags in current directory with tag location file preview (users are required to run ctags -R to generate tags
|
--- Lists tags in current directory with tag location file preview (users are required to run ctags -R to generate tags
|
||||||
@@ -133,7 +133,7 @@ builtin.current_buffer_tags = require_on_exported_call("telescope.builtin.__file
|
|||||||
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
||||||
---@field show_untracked boolean: if true, adds `--others` flag to command and shows untracked files (default: false)
|
---@field show_untracked boolean: if true, adds `--others` flag to command and shows untracked files (default: false)
|
||||||
---@field recurse_submodules boolean: if true, adds the `--recurse-submodules` flag to command (default: false)
|
---@field recurse_submodules boolean: if true, adds the `--recurse-submodules` flag to command (default: false)
|
||||||
---@field git_command table: command that will be exectued. {"git","ls-files","--exclude-standard","--cached"}
|
---@field git_command table: command that will be executed. {"git","ls-files","--exclude-standard","--cached"}
|
||||||
builtin.git_files = require_on_exported_call("telescope.builtin.__git").files
|
builtin.git_files = require_on_exported_call("telescope.builtin.__git").files
|
||||||
|
|
||||||
--- Lists commits for current directory with diff preview
|
--- Lists commits for current directory with diff preview
|
||||||
@@ -145,11 +145,11 @@ builtin.git_files = require_on_exported_call("telescope.builtin.__git").files
|
|||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field cwd string: specify the path of the repo
|
---@field cwd string: specify the path of the repo
|
||||||
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
||||||
---@field git_command table: command that will be exectued. {"git","log","--pretty=oneline","--abbrev-commit","--","."}
|
---@field git_command table: command that will be executed. {"git","log","--pretty=oneline","--abbrev-commit","--","."}
|
||||||
builtin.git_commits = require_on_exported_call("telescope.builtin.__git").commits
|
builtin.git_commits = require_on_exported_call("telescope.builtin.__git").commits
|
||||||
|
|
||||||
--- Lists commits for current buffer with diff preview
|
--- Lists commits for current buffer with diff preview
|
||||||
--- - Default keymaps or your overriden `select_` keys:
|
--- - Default keymaps or your overridden `select_` keys:
|
||||||
--- - `<cr>`: checks out the currently selected commit
|
--- - `<cr>`: checks out the currently selected commit
|
||||||
--- - `<c-v>`: opens a diff in a vertical split
|
--- - `<c-v>`: opens a diff in a vertical split
|
||||||
--- - `<c-x>`: opens a diff in a horizontal split
|
--- - `<c-x>`: opens a diff in a horizontal split
|
||||||
@@ -158,7 +158,7 @@ builtin.git_commits = require_on_exported_call("telescope.builtin.__git").commit
|
|||||||
---@field cwd string: specify the path of the repo
|
---@field cwd string: specify the path of the repo
|
||||||
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true)
|
||||||
---@field current_file string: specify the current file that should be used for bcommits (default: current buffer)
|
---@field current_file string: specify the current file that should be used for bcommits (default: current buffer)
|
||||||
---@field git_command table: command that will be exectued. {"git","log","--pretty=oneline","--abbrev-commit"}
|
---@field git_command table: command that will be executed. {"git","log","--pretty=oneline","--abbrev-commit"}
|
||||||
builtin.git_bcommits = require_on_exported_call("telescope.builtin.__git").bcommits
|
builtin.git_bcommits = require_on_exported_call("telescope.builtin.__git").bcommits
|
||||||
|
|
||||||
--- List branches for current directory, with output from `git log --oneline` shown in the preview window
|
--- List branches for current directory, with output from `git log --oneline` shown in the preview window
|
||||||
@@ -224,8 +224,8 @@ builtin.pickers = require_on_exported_call("telescope.builtin.__internal").picke
|
|||||||
|
|
||||||
--- Use the telescope...
|
--- Use the telescope...
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field show_pluto boolean: we love pluto (default: false, because its a hidden feature)
|
---@field show_pluto boolean: we love Pluto (default: false, because its a hidden feature)
|
||||||
---@field show_moon boolean: we love the moon (default: false, because its a hidden feature)
|
---@field show_moon boolean: we love the Moon (default: false, because its a hidden feature)
|
||||||
builtin.planets = require_on_exported_call("telescope.builtin.__internal").planets
|
builtin.planets = require_on_exported_call("telescope.builtin.__internal").planets
|
||||||
|
|
||||||
--- Lists symbols inside of `data/telescope-sources/*.json` found in your runtime path
|
--- Lists symbols inside of `data/telescope-sources/*.json` found in your runtime path
|
||||||
|
|||||||
@@ -198,9 +198,9 @@ append(
|
|||||||
and `actions.layout.cycle_layout_prev`.
|
and `actions.layout.cycle_layout_prev`.
|
||||||
Should be a list of "layout setups".
|
Should be a list of "layout setups".
|
||||||
Each "layout setup" can take one of two forms:
|
Each "layout setup" can take one of two forms:
|
||||||
1. string <br>
|
1. string
|
||||||
This is interpreted as the name of a `layout_strategy`
|
This is interpreted as the name of a `layout_strategy`
|
||||||
2. table <br>
|
2. table
|
||||||
A table with possible keys `layout_strategy`, `layout_config` and `previewer`
|
A table with possible keys `layout_strategy`, `layout_config` and `previewer`
|
||||||
|
|
||||||
Default: { "horizontal", "vertical" }
|
Default: { "horizontal", "vertical" }
|
||||||
@@ -241,7 +241,6 @@ append(
|
|||||||
[[
|
[[
|
||||||
The character(s) that will be shown in front of the current selection.
|
The character(s) that will be shown in front of the current selection.
|
||||||
|
|
||||||
|
|
||||||
Default: '> ']]
|
Default: '> ']]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -289,7 +288,7 @@ append(
|
|||||||
"path_display",
|
"path_display",
|
||||||
{},
|
{},
|
||||||
[[
|
[[
|
||||||
Determines how file paths are displayed
|
Determines how file paths are displayed.
|
||||||
|
|
||||||
path_display can be set to an array with a combination of:
|
path_display can be set to an array with a combination of:
|
||||||
- "hidden" hide file names
|
- "hidden" hide file names
|
||||||
@@ -302,7 +301,7 @@ append(
|
|||||||
- "shorten" only display the first character of each directory in
|
- "shorten" only display the first character of each directory in
|
||||||
the path
|
the path
|
||||||
- "truncate" truncates the start of the path when the whole path will
|
- "truncate" truncates the start of the path when the whole path will
|
||||||
not fit. To increase the the gap between the path and the edge.
|
not fit. To increase the gap between the path and the edge,
|
||||||
set truncate to number `truncate = 3`
|
set truncate to number `truncate = 3`
|
||||||
|
|
||||||
You can also specify the number of characters of each directory name
|
You can also specify the number of characters of each directory name
|
||||||
@@ -418,7 +417,7 @@ append(
|
|||||||
[[
|
[[
|
||||||
Defines the default title of the prompt window. A false value
|
Defines the default title of the prompt window. A false value
|
||||||
can be used to hide the title altogether. Most of the times builtins
|
can be used to hide the title altogether. Most of the times builtins
|
||||||
define a prompt_title which will be prefered over this default.
|
define a prompt_title which will be preferred over this default.
|
||||||
|
|
||||||
Default: "Prompt"]]
|
Default: "Prompt"]]
|
||||||
)
|
)
|
||||||
@@ -442,6 +441,8 @@ append(
|
|||||||
|
|
||||||
Will allow you to completely remove all of telescope's default maps
|
Will allow you to completely remove all of telescope's default maps
|
||||||
and use your own.
|
and use your own.
|
||||||
|
|
||||||
|
Default: nil
|
||||||
]]
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -469,11 +470,11 @@ append(
|
|||||||
|
|
||||||
Fields:
|
Fields:
|
||||||
- path: The path to the telescope history as string.
|
- path: The path to the telescope history as string.
|
||||||
default: stdpath("data")/telescope_history
|
Default: stdpath("data")/telescope_history
|
||||||
- limit: The amount of entries that will be written in the
|
- limit: The amount of entries that will be written in the
|
||||||
history.
|
history.
|
||||||
Warning: If limit is set to nil it will grow unbound.
|
Warning: If limit is set to nil it will grow unbound.
|
||||||
default: 100
|
Default: 100
|
||||||
- handler: A lua function that implements the history.
|
- handler: A lua function that implements the history.
|
||||||
This is meant as a developer setting for extensions to
|
This is meant as a developer setting for extensions to
|
||||||
override the history handling, e.g.,
|
override the history handling, e.g.,
|
||||||
@@ -678,7 +679,7 @@ append(
|
|||||||
[[
|
[[
|
||||||
A function pointer that specifies the file_sorter. This sorter will
|
A function pointer that specifies the file_sorter. This sorter will
|
||||||
be used for find_files, git_files and similar.
|
be used for find_files, git_files and similar.
|
||||||
Hint: If you load a native sorter, you dont need to change this value,
|
Hint: If you load a native sorter, you don't need to change this value,
|
||||||
the native sorter will override it anyway.
|
the native sorter will override it anyway.
|
||||||
|
|
||||||
Default: require("telescope.sorters").get_fzy_sorter]]
|
Default: require("telescope.sorters").get_fzy_sorter]]
|
||||||
@@ -690,7 +691,7 @@ append(
|
|||||||
[[
|
[[
|
||||||
A function pointer to the generic sorter. The sorter that should be
|
A function pointer to the generic sorter. The sorter that should be
|
||||||
used for everything that is not a file.
|
used for everything that is not a file.
|
||||||
Hint: If you load a native sorter, you dont need to change this value,
|
Hint: If you load a native sorter, you don't need to change this value,
|
||||||
the native sorter will override it anyway.
|
the native sorter will override it anyway.
|
||||||
|
|
||||||
Default: require("telescope.sorters").get_fzy_sorter]]
|
Default: require("telescope.sorters").get_fzy_sorter]]
|
||||||
@@ -703,7 +704,7 @@ append(
|
|||||||
[[
|
[[
|
||||||
This points to a wrapper sorter around the generic_sorter that is able
|
This points to a wrapper sorter around the generic_sorter that is able
|
||||||
to do prefiltering.
|
to do prefiltering.
|
||||||
Its usually used for lsp_*_symbols and lsp_*_diagnostics
|
It's usually used for lsp_*_symbols and lsp_*_diagnostics
|
||||||
|
|
||||||
Default: require("telescope.sorters").prefilter]]
|
Default: require("telescope.sorters").prefilter]]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ local telescope = {}
|
|||||||
---
|
---
|
||||||
--- Getting started with telescope:
|
--- Getting started with telescope:
|
||||||
--- 1. Run `:checkhealth telescope` to make sure everything is installed.
|
--- 1. Run `:checkhealth telescope` to make sure everything is installed.
|
||||||
--- 2. Evaluate it working with
|
--- 2. Evaluate it is working with
|
||||||
--- `:Telescope find_files` or
|
--- `:Telescope find_files` or
|
||||||
--- `:lua require("telescope.builtin").find_files()`
|
--- `:lua require("telescope.builtin").find_files()`
|
||||||
--- 3. Put a `require("telescope").setup() call somewhere in your neovim config.
|
--- 3. Put a `require("telescope").setup()` call somewhere in your neovim config.
|
||||||
--- 4. Read |telescope.setup| to check what config keys are available and what you can put inside the setup call
|
--- 4. Read |telescope.setup| to check what config keys are available and what you can put inside the setup call
|
||||||
--- 5. Read |telescope.builtin| to check which builtin pickers are offered and what options these implement
|
--- 5. Read |telescope.builtin| to check which builtin pickers are offered and what options these implement
|
||||||
--- 6. Profit
|
--- 6. Profit
|
||||||
@@ -31,14 +31,14 @@ local telescope = {}
|
|||||||
--- │ │ ┌───│Manager│────│ Sorter │┐ └───┬───* │
|
--- │ │ ┌───│Manager│────│ Sorter │┐ └───┬───* │
|
||||||
--- │ ▼ ▼ └───────* └────────┘│ │ │
|
--- │ ▼ ▼ └───────* └────────┘│ │ │
|
||||||
--- │ 1────────┐ 2───┴──┐ │ │
|
--- │ 1────────┐ 2───┴──┐ │ │
|
||||||
--- │ ┌─────│ Picker │ │Finder│◄────┘ │
|
--- │ ┌─────│ Picker │ │Finder│◀────┘ │
|
||||||
--- │ ▼ └───┬────┘ └──────* │
|
--- │ ▼ └───┬────┘ └──────* │
|
||||||
--- │ ┌────────┐ │ 3────────+ ▲ │
|
--- │ ┌────────┐ │ 3────────+ ▲ │
|
||||||
--- │ │Selected│ └───────│ Prompt │─────────┘ │
|
--- │ │Selected│ └───────│ Prompt │─────────┘ │
|
||||||
--- │ │ Entry │ └───┬────┘ │
|
--- │ │ Entry │ └───┬────┘ │
|
||||||
--- │ └────────* ┌───┴────┐ ┌────────┐ ┌────────┐ │
|
--- │ └────────* ┌───┴────┐ ┌────────┐ ┌────────┐ │
|
||||||
--- │ │ ▲ 4─────────┐│ Prompt │ │(Attach)│ │Actions │ │
|
--- │ │ ▲ 4─────────┐│ Prompt │ │(Attach)│ │Actions │ │
|
||||||
--- │ ▼ └──► │ Results ││ Buffer │◄─┤Mappings│◄─┤User Fn │ │
|
--- │ ▼ └──▶ │ Results ││ Buffer │◀─┤Mappings│◀─┤User Fn │ │
|
||||||
--- │5─────────┐ └─────────┘└────────┘ └────────┘ └────────┘ │
|
--- │5─────────┐ └─────────┘└────────┘ └────────┘ └────────┘ │
|
||||||
--- ││Previewer│ │
|
--- ││Previewer│ │
|
||||||
--- │└─────────┘ telescope.nvim architecture │
|
--- │└─────────┘ telescope.nvim architecture │
|
||||||
|
|||||||
@@ -11,24 +11,23 @@
|
|||||||
--- an entry. This function will return an entry table (or nil, meaning skip
|
--- an entry. This function will return an entry table (or nil, meaning skip
|
||||||
--- this entry) which contains the following important keys:
|
--- this entry) which contains the following important keys:
|
||||||
--- - value any: value key can be anything but still required
|
--- - value any: value key can be anything but still required
|
||||||
--- - valid bool: is an optional key because it defaults to true but if the key
|
--- - valid bool (optional): is an optional key because it defaults to true but if the key
|
||||||
--- is set to false it will not be displayed by the picker (optional)
|
--- is set to false it will not be displayed by the picker
|
||||||
--- - ordinal string: is the text that is used for filtering (required)
|
--- - ordinal string: is the text that is used for filtering
|
||||||
--- - display string|function: is either a string of the text that is being
|
--- - display string|function: is either a string of the text that is being
|
||||||
--- displayed or a function receiving the entry at a later stage, when the entry
|
--- displayed or a function receiving the entry at a later stage, when the entry
|
||||||
--- is actually being displayed. A function can be useful here if a complex
|
--- is actually being displayed. A function can be useful here if a complex
|
||||||
--- calculation has to be done. `make_entry` can also return a second value
|
--- calculation has to be done. `make_entry` can also return a second value -
|
||||||
--- a highlight array which will then apply to the line. Highlight entry in
|
--- a highlight array which will then apply to the line. Highlight entry in
|
||||||
--- this array has the following signature `{ { start_col, end_col }, hl_group }`
|
--- this array has the following signature `{ { start_col, end_col }, hl_group }`
|
||||||
--- (required)
|
--- - filename string (optional): will be interpreted by the default `<cr>` action as
|
||||||
--- - filename string: will be interpreted by the default `<cr>` action as
|
--- open this file
|
||||||
--- open this file (optional)
|
--- - bufnr number (optional): will be interpreted by the default `<cr>` action as open
|
||||||
--- - bufnr number: will be interpreted by the default `<cr>` action as open
|
--- this buffer
|
||||||
--- this buffer (optional)
|
--- - lnum number (optional): lnum value which will be interpreted by the default `<cr>`
|
||||||
--- - lnum number: lnum value which will be interpreted by the default `<cr>`
|
--- action as a jump to this line
|
||||||
--- action as a jump to this line (optional)
|
--- - col number (optional): col value which will be interpreted by the default `<cr>`
|
||||||
--- - col number: col value which will be interpreted by the default `<cr>`
|
--- action as a jump to this column
|
||||||
--- action as a jump to this column (optional)
|
|
||||||
---
|
---
|
||||||
--- For more information on easier displaying, see |telescope.pickers.entry_display|
|
--- For more information on easier displaying, see |telescope.pickers.entry_display|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
---@brief [[
|
---@brief [[
|
||||||
--- |telescope.mappings| is used to configure the keybindings within
|
--- |telescope.mappings| is used to configure the keybindings within
|
||||||
--- a telescope picker. These keybinds are only local to the picker window
|
--- a telescope picker. These key binds are only local to the picker window
|
||||||
--- and will be cleared once you exit the picker.
|
--- and will be cleared once you exit the picker.
|
||||||
---
|
---
|
||||||
--- We provide multiple different ways of configuring, as described below,
|
--- We provide multiple configuration options to make it easy for you to adjust
|
||||||
--- to provide an easy to use experience for changing the default behavior
|
--- telescope's default key bindings and create your own custom key binds.
|
||||||
--- of telescope or extending for your own purposes.
|
|
||||||
---
|
---
|
||||||
--- To see many of the builtin actions that you can use as values for this
|
--- To see many of the builtin actions that you can use as values for this
|
||||||
--- table, see |telescope.actions|
|
--- table, see |telescope.actions|
|
||||||
@@ -39,7 +38,6 @@
|
|||||||
--- ...,
|
--- ...,
|
||||||
--- }
|
--- }
|
||||||
--- </code>
|
--- </code>
|
||||||
--- Into your config.
|
|
||||||
---
|
---
|
||||||
--- To override behavior of a key, simply set the value
|
--- To override behavior of a key, simply set the value
|
||||||
--- to be a function (either by requiring an action or by writing
|
--- to be a function (either by requiring an action or by writing
|
||||||
@@ -53,7 +51,7 @@
|
|||||||
--- </code>
|
--- </code>
|
||||||
---
|
---
|
||||||
--- If the function you want is part of `telescope.actions`, then you can
|
--- If the function you want is part of `telescope.actions`, then you can
|
||||||
--- simply give a string.
|
--- simply supply the function name as a string.
|
||||||
--- For example, the previous option is equivalent to:
|
--- For example, the previous option is equivalent to:
|
||||||
--- <code>
|
--- <code>
|
||||||
--- {
|
--- {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
--- for the best performance.
|
--- for the best performance.
|
||||||
---
|
---
|
||||||
--- The create function will use the column widths passed to it in
|
--- The create function will use the column widths passed to it in
|
||||||
--- configaration.items. Each item in that table is the number of characters in
|
--- configuration.items. Each item in that table is the number of characters in
|
||||||
--- the column. It's also possible for the final column to not have a fixed
|
--- the column. It's also possible for the final column to not have a fixed
|
||||||
--- width, this will be shown in the configuration as 'remaining = true'.
|
--- width, this will be shown in the configuration as 'remaining = true'.
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
--- - columns : (number) Columns in the vim window
|
--- - columns : (number) Columns in the vim window
|
||||||
--- - lines : (number) Lines in the vim window
|
--- - lines : (number) Lines in the vim window
|
||||||
--- - layout_config : (table) The configuration values specific to the picker.
|
--- - layout_config : (table) The configuration values specific to the picker.
|
||||||
---
|
|
||||||
--- </pre>
|
--- </pre>
|
||||||
---
|
---
|
||||||
--- This means you can create your own layout strategy if you want! Just be aware
|
--- This means you can create your own layout strategy if you want! Just be aware
|
||||||
@@ -550,6 +549,7 @@ layout_strategies.center = make_documented_layout(
|
|||||||
--- │ │
|
--- │ │
|
||||||
--- └──────────────────────────────────────────────────┘
|
--- └──────────────────────────────────────────────────┘
|
||||||
--- </pre>
|
--- </pre>
|
||||||
|
---@eval { ["description"] = require("telescope.pickers.layout_strategies")._format("cursor") }
|
||||||
layout_strategies.cursor = make_documented_layout(
|
layout_strategies.cursor = make_documented_layout(
|
||||||
"cursor",
|
"cursor",
|
||||||
vim.tbl_extend("error", {
|
vim.tbl_extend("error", {
|
||||||
|
|||||||
@@ -221,8 +221,8 @@ previewers.qflist = term_previewer.qflist
|
|||||||
--- vim.api.nvim_buf_call(bufnr, function()
|
--- vim.api.nvim_buf_call(bufnr, function()
|
||||||
--- -- for example `search` and `matchadd`
|
--- -- for example `search` and `matchadd`
|
||||||
--- end)
|
--- end)
|
||||||
--- to achieve that.
|
|
||||||
--- </code>
|
--- </code>
|
||||||
|
--- to achieve that.
|
||||||
--- - If you want to read a file into the buffer it's best to use
|
--- - If you want to read a file into the buffer it's best to use
|
||||||
--- `buffer_previewer_maker`. But access this function with
|
--- `buffer_previewer_maker`. But access this function with
|
||||||
--- `require('telescope.config').values.buffer_previewer_maker`
|
--- `require('telescope.config').values.buffer_previewer_maker`
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ local themes = {}
|
|||||||
---
|
---
|
||||||
--- Usage:
|
--- Usage:
|
||||||
--- <code>
|
--- <code>
|
||||||
--- `local builtin = require('telescope.builtin')`
|
--- local opts = {...} -- picker options
|
||||||
--- `local themes = require('telescope.themes')`
|
--- local builtin = require('telescope.builtin')
|
||||||
--- `builtin.find_files(themes.get_dropdown())`
|
--- local themes = require('telescope.themes')
|
||||||
|
--- builtin.find_files(themes.get_dropdown(opts))
|
||||||
--- </code>
|
--- </code>
|
||||||
function themes.get_dropdown(opts)
|
function themes.get_dropdown(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
@@ -67,10 +68,10 @@ end
|
|||||||
---
|
---
|
||||||
--- Usage:
|
--- Usage:
|
||||||
--- <code>
|
--- <code>
|
||||||
---
|
--- local opts = {...} -- picker options
|
||||||
--- `local builtin = require('telescope.builtin')`
|
--- local builtin = require('telescope.builtin')
|
||||||
--- `local themes = require('telescope.themes')`
|
--- local themes = require('telescope.themes')
|
||||||
--- `builtin.lsp_references(themes.get_cursor())`
|
--- builtin.find_files(themes.get_cursor(opts))
|
||||||
--- </code>
|
--- </code>
|
||||||
function themes.get_cursor(opts)
|
function themes.get_cursor(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
@@ -99,9 +100,10 @@ end
|
|||||||
---
|
---
|
||||||
--- Usage:
|
--- Usage:
|
||||||
--- <code>
|
--- <code>
|
||||||
--- `local builtin = require('telescope.builtin')`
|
--- local opts = {...} -- picker options
|
||||||
--- `local themes = require('telescope.themes')`
|
--- local builtin = require('telescope.builtin')
|
||||||
--- `builtin.find_files(themes.get_ivy())`
|
--- local themes = require('telescope.themes')
|
||||||
|
--- builtin.find_files(themes.get_ivy(opts))
|
||||||
--- </code>
|
--- </code>
|
||||||
function themes.get_ivy(opts)
|
function themes.get_ivy(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ end
|
|||||||
--- this function outside of telescope might yield to undefined behavior and will
|
--- this function outside of telescope might yield to undefined behavior and will
|
||||||
--- not be addressed by us
|
--- not be addressed by us
|
||||||
---@param opts table: The opts the users passed into the picker. Might contains a path_display key
|
---@param opts table: The opts the users passed into the picker. Might contains a path_display key
|
||||||
---@param path string: The path that should be formated
|
---@param path string: The path that should be formatted
|
||||||
---@return string: The transformed path ready to be displayed
|
---@return string: The transformed path ready to be displayed
|
||||||
utils.transform_path = function(opts, path)
|
utils.transform_path = function(opts, path)
|
||||||
if path == nil then
|
if path == nil then
|
||||||
|
|||||||
Reference in New Issue
Block a user