* fix: related to #13 telescope-project, enter insert mode on prompt close * fix: related to #13 telescope-project, enter insert mode on prompt close * revert changes made in error * fix PR issue * fix: undefined variable do_close * use action_state as actions is deprecated * [docgen] Update doc/telescope.txt skip-checks: true Co-authored-by: Github Actions <actions@github>
This commit is contained in:
committed by
GitHub
parent
284f38c575
commit
812fae1d71
@@ -12,30 +12,6 @@ https://github.com/nvim-telescope/telescope.nvim
|
|||||||
:h telescope.layout
|
:h telescope.layout
|
||||||
:h telescope.actions
|
:h telescope.actions
|
||||||
|
|
||||||
telescope.extensions() *telescope.extensions()*
|
|
||||||
Use telescope.extensions to reference any extensions within your
|
|
||||||
configuration.
|
|
||||||
While the docs currently generate this as a function, it's actually a
|
|
||||||
table. Sorry.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
telescope.load_extension({name}) *telescope.load_extension()*
|
|
||||||
Load an extension.
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{name} (string) Name of the extension
|
|
||||||
|
|
||||||
|
|
||||||
telescope.register_extension({mod}) *telescope.register_extension()*
|
|
||||||
Register an extension. To be used by plugin authors.
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{mod} (table) Module
|
|
||||||
|
|
||||||
|
|
||||||
telescope.setup({opts}) *telescope.setup()*
|
telescope.setup({opts}) *telescope.setup()*
|
||||||
Setup function to be run by user. Configures the defaults, extensions and
|
Setup function to be run by user. Configures the defaults, extensions and
|
||||||
other aspects of telescope.
|
other aspects of telescope.
|
||||||
@@ -90,6 +66,30 @@ telescope.setup({opts}) *telescope.setup()*
|
|||||||
{opts} (table) Configuration opts. Keys: defaults, extensions
|
{opts} (table) Configuration opts. Keys: defaults, extensions
|
||||||
|
|
||||||
|
|
||||||
|
telescope.register_extension({mod}) *telescope.register_extension()*
|
||||||
|
Register an extension. To be used by plugin authors.
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{mod} (table) Module
|
||||||
|
|
||||||
|
|
||||||
|
telescope.load_extension({name}) *telescope.load_extension()*
|
||||||
|
Load an extension.
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{name} (string) Name of the extension
|
||||||
|
|
||||||
|
|
||||||
|
telescope.extensions() *telescope.extensions()*
|
||||||
|
Use telescope.extensions to reference any extensions within your
|
||||||
|
configuration.
|
||||||
|
While the docs currently generate this as a function, it's actually a
|
||||||
|
table. Sorry.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
*telescope.builtin*
|
*telescope.builtin*
|
||||||
@@ -116,22 +116,6 @@ builtin.live_grep() *builtin.live_grep()*
|
|||||||
|
|
||||||
Actions functions that are useful for people creating their own mappings.
|
Actions functions that are useful for people creating their own mappings.
|
||||||
|
|
||||||
actions.add_selection({prompt_bufnr}) *actions.add_selection()*
|
|
||||||
Add current entry to multi select
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{prompt_bufnr} (number) The prompt bufnr
|
|
||||||
|
|
||||||
|
|
||||||
actions.move_selection_better({prompt_bufnr})*actions.move_selection_better()*
|
|
||||||
Move the selection to the entry that has a better score
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{prompt_bufnr} (number) The prompt bufnr
|
|
||||||
|
|
||||||
|
|
||||||
actions.move_selection_next({prompt_bufnr}) *actions.move_selection_next()*
|
actions.move_selection_next({prompt_bufnr}) *actions.move_selection_next()*
|
||||||
Move the selection to the next entry
|
Move the selection to the next entry
|
||||||
|
|
||||||
@@ -156,16 +140,8 @@ actions.move_selection_worse({prompt_bufnr}) *actions.move_selection_worse()*
|
|||||||
{prompt_bufnr} (number) The prompt bufnr
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
actions.move_to_bottom({prompt_bufnr}) *actions.move_to_bottom()*
|
actions.move_selection_better({prompt_bufnr})*actions.move_selection_better()*
|
||||||
Move to the bottom of the picker
|
Move the selection to the entry that has a better score
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{prompt_bufnr} (number) The prompt bufnr
|
|
||||||
|
|
||||||
|
|
||||||
actions.move_to_middle({prompt_bufnr}) *actions.move_to_middle()*
|
|
||||||
Move to the middle of the picker
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
@@ -180,10 +156,29 @@ actions.move_to_top({prompt_bufnr}) *actions.move_to_top()*
|
|||||||
{prompt_bufnr} (number) The prompt bufnr
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
actions.open_qflist() *actions.open_qflist()*
|
actions.move_to_middle({prompt_bufnr}) *actions.move_to_middle()*
|
||||||
Open the quickfix list
|
Move to the middle of the picker
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
|
actions.move_to_bottom({prompt_bufnr}) *actions.move_to_bottom()*
|
||||||
|
Move to the bottom of the picker
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
|
actions.add_selection({prompt_bufnr}) *actions.add_selection()*
|
||||||
|
Add current entry to multi select
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
actions.remove_selection({prompt_bufnr}) *actions.remove_selection()*
|
actions.remove_selection({prompt_bufnr}) *actions.remove_selection()*
|
||||||
Remove current entry from multi select
|
Remove current entry from multi select
|
||||||
@@ -201,6 +196,11 @@ actions.toggle_selection({prompt_bufnr}) *actions.toggle_selection()*
|
|||||||
{prompt_bufnr} (number) The prompt bufnr
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
|
actions.open_qflist() *actions.open_qflist()*
|
||||||
|
Open the quickfix list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
*telescope.previewers*
|
*telescope.previewers*
|
||||||
@@ -257,16 +257,31 @@ previewers.Previewer() *previewers.Previewer()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.buffer_previewer_maker({filepath}, {bufnr}, {opts})*previewers.buffer_previewer_maker()*
|
previewers.new() *previewers.new()*
|
||||||
A universal way of reading a file into a buffer previewer. It handles async
|
A shorthand for creating a new Previewer. The provided table will be
|
||||||
reading, cache, highlighting, displaying directories and provides a
|
forwarded to `Previewer:new(...)`
|
||||||
callback which can be used, to jump to a line in the buffer.
|
|
||||||
|
|
||||||
|
|
||||||
Parameters: ~
|
|
||||||
{filepath} (string) String to the filepath, will be expanded
|
previewers.new_termopen_previewer() *previewers.new_termopen_previewer()*
|
||||||
{bufnr} (number) Where the content will be written
|
Is a wrapper around Previewer and helps with creating a new
|
||||||
{opts} (table) keys: `use_ft_detect`, `bufname` and `callback`
|
`termopen_previewer`.
|
||||||
|
|
||||||
|
It requires you to specify one table entry `get_command(entry, status)`.
|
||||||
|
This `get_command` function has to return the terminal command that will be
|
||||||
|
executed for each entry. Example: get_command = function(entry, status)
|
||||||
|
return { 'bat', entry.path } end
|
||||||
|
|
||||||
|
It's an easy way to get your first previewer going and it integrates well
|
||||||
|
with `bat` and `less`. Providing out of the box scrolling if the command
|
||||||
|
uses less.
|
||||||
|
|
||||||
|
Furthermore, it will forward all `config.set_env` environment variables to
|
||||||
|
that terminal process.
|
||||||
|
|
||||||
|
While this interface is a good start, it was replaced with the way more
|
||||||
|
flexible `buffer_previewer` and is now deprecated.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.cat() *previewers.cat()*
|
previewers.cat() *previewers.cat()*
|
||||||
@@ -282,18 +297,30 @@ previewers.cat() *previewers.cat()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.display_content() *previewers.display_content()*
|
previewers.vimgrep() *previewers.vimgrep()*
|
||||||
A deprecated way of displaying content more easily. Was written at a time,
|
Provides a `termopen_previewer` which has the ability to display files at
|
||||||
where the buffer_previewer interface wasn't present. Nowadays it's easier
|
the provided line. It has support for `bat`(prioritized) and `cat`. Each
|
||||||
to just use this. We will keep it around for backwards compatibility
|
entry has to provide either the field `path` or `filename` and a `lnum`
|
||||||
because some extensions use it. It doesn't use cache or some other clever
|
field in order to make this previewer work.
|
||||||
tricks.
|
|
||||||
|
The preferred way of using this previewer is like this
|
||||||
|
`require('telescope.config').values.grep_previewer` This will respect user
|
||||||
|
configuration and will use `buffer_previewers` in case it's configured that
|
||||||
|
way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.new() *previewers.new()*
|
previewers.qflist() *previewers.qflist()*
|
||||||
A shorthand for creating a new Previewer. The provided table will be
|
Provides a `termopen_previewer` which has the ability to display files at
|
||||||
forwarded to `Previewer:new(...)`
|
the provided line or range. It has support for `bat`(prioritized) and
|
||||||
|
`cat`. Each entry has to provide either the field `path` or `filename`,
|
||||||
|
`lnum` and a `start` and `finish` range in order to make this previewer
|
||||||
|
work.
|
||||||
|
|
||||||
|
The preferred way of using this previewer is like this
|
||||||
|
`require('telescope.config').values.qflist_previewer` This will respect
|
||||||
|
user configuration and will use buffer previewers in case it's configured
|
||||||
|
that way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -385,39 +412,16 @@ previewers.new_buffer_previewer() *previewers.new_buffer_previewer()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.new_termopen_previewer() *previewers.new_termopen_previewer()*
|
previewers.buffer_previewer_maker({filepath}, {bufnr}, {opts})*previewers.buffer_previewer_maker()*
|
||||||
Is a wrapper around Previewer and helps with creating a new
|
A universal way of reading a file into a buffer previewer. It handles async
|
||||||
`termopen_previewer`.
|
reading, cache, highlighting, displaying directories and provides a
|
||||||
|
callback which can be used, to jump to a line in the buffer.
|
||||||
It requires you to specify one table entry `get_command(entry, status)`.
|
|
||||||
This `get_command` function has to return the terminal command that will be
|
|
||||||
executed for each entry. Example: get_command = function(entry, status)
|
|
||||||
return { 'bat', entry.path } end
|
|
||||||
|
|
||||||
It's an easy way to get your first previewer going and it integrates well
|
|
||||||
with `bat` and `less`. Providing out of the box scrolling if the command
|
|
||||||
uses less.
|
|
||||||
|
|
||||||
Furthermore, it will forward all `config.set_env` environment variables to
|
|
||||||
that terminal process.
|
|
||||||
|
|
||||||
While this interface is a good start, it was replaced with the way more
|
|
||||||
flexible `buffer_previewer` and is now deprecated.
|
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
previewers.qflist() *previewers.qflist()*
|
{filepath} (string) String to the filepath, will be expanded
|
||||||
Provides a `termopen_previewer` which has the ability to display files at
|
{bufnr} (number) Where the content will be written
|
||||||
the provided line or range. It has support for `bat`(prioritized) and
|
{opts} (table) keys: `use_ft_detect`, `bufname` and `callback`
|
||||||
`cat`. Each entry has to provide either the field `path` or `filename`,
|
|
||||||
`lnum` and a `start` and `finish` range in order to make this previewer
|
|
||||||
work.
|
|
||||||
|
|
||||||
The preferred way of using this previewer is like this
|
|
||||||
`require('telescope.config').values.qflist_previewer` This will respect
|
|
||||||
user configuration and will use buffer previewers in case it's configured
|
|
||||||
that way.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.vim_buffer_cat() *previewers.vim_buffer_cat()*
|
previewers.vim_buffer_cat() *previewers.vim_buffer_cat()*
|
||||||
@@ -431,6 +435,18 @@ previewers.vim_buffer_cat() *previewers.vim_buffer_cat()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
previewers.vim_buffer_vimgrep() *previewers.vim_buffer_vimgrep()*
|
||||||
|
A previewer that is used to display a file and jump to the provided line.
|
||||||
|
It uses the `buffer_previewer` interface. To integrate this one into your
|
||||||
|
own picker make sure that the field `path` or `filename` and `lnum` is set
|
||||||
|
in each entry. If the latter is not present, it will default to the first
|
||||||
|
line. The preferred way of using this previewer is like this
|
||||||
|
`require('telescope.config').values.grep_previewer` This will respect user
|
||||||
|
configuration and will use `termopen_previewer` in case it's configured
|
||||||
|
that way.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.vim_buffer_qflist() *previewers.vim_buffer_qflist()*
|
previewers.vim_buffer_qflist() *previewers.vim_buffer_qflist()*
|
||||||
Is the same as `vim_buffer_vimgrep` and only exist for consistency with
|
Is the same as `vim_buffer_vimgrep` and only exist for consistency with
|
||||||
`term_previewers`.
|
`term_previewers`.
|
||||||
@@ -442,28 +458,12 @@ previewers.vim_buffer_qflist() *previewers.vim_buffer_qflist()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.vim_buffer_vimgrep() *previewers.vim_buffer_vimgrep()*
|
previewers.display_content() *previewers.display_content()*
|
||||||
A previewer that is used to display a file and jump to the provided line.
|
A deprecated way of displaying content more easily. Was written at a time,
|
||||||
It uses the `buffer_previewer` interface. To integrate this one into your
|
where the buffer_previewer interface wasn't present. Nowadays it's easier
|
||||||
own picker make sure that the field `path` or `filename` and `lnum` is set
|
to just use this. We will keep it around for backwards compatibility
|
||||||
in each entry. If the latter is not present, it will default to the first
|
because some extensions use it. It doesn't use cache or some other clever
|
||||||
line. The preferred way of using this previewer is like this
|
tricks.
|
||||||
`require('telescope.config').values.grep_previewer` This will respect user
|
|
||||||
configuration and will use `termopen_previewer` in case it's configured
|
|
||||||
that way.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
previewers.vimgrep() *previewers.vimgrep()*
|
|
||||||
Provides a `termopen_previewer` which has the ability to display files at
|
|
||||||
the provided line. It has support for `bat`(prioritized) and `cat`. Each
|
|
||||||
entry has to provide either the field `path` or `filename` and a `lnum`
|
|
||||||
field in order to make this previewer work.
|
|
||||||
|
|
||||||
The preferred way of using this previewer is like this
|
|
||||||
`require('telescope.config').values.grep_previewer` This will respect user
|
|
||||||
configuration and will use `buffer_previewers` in case it's configured that
|
|
||||||
way.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -524,6 +524,20 @@ horizontal and vertical layouts):
|
|||||||
- scroll_speed:
|
- scroll_speed:
|
||||||
- Change the scrolling speed of the previewer
|
- Change the scrolling speed of the previewer
|
||||||
|
|
||||||
|
layout_strategies.horizontal() *layout_strategies.horizontal()*
|
||||||
|
Horizontal previewer
|
||||||
|
|
||||||
|
+-------------+--------------+
|
||||||
|
| | |
|
||||||
|
| Results | |
|
||||||
|
| | Preview |
|
||||||
|
| | |
|
||||||
|
+-------------| |
|
||||||
|
| Prompt | |
|
||||||
|
+-------------+--------------+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout_strategies.center() *layout_strategies.center()*
|
layout_strategies.center() *layout_strategies.center()*
|
||||||
Centered layout wih smaller default sizes (I think)
|
Centered layout wih smaller default sizes (I think)
|
||||||
|
|
||||||
@@ -539,31 +553,6 @@ layout_strategies.center() *layout_strategies.center()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout_strategies.flex() *layout_strategies.flex()*
|
|
||||||
Swap between `horizontal` and `vertical` strategies based on the window
|
|
||||||
width
|
|
||||||
- Supports `vertical` or `horizontal` features
|
|
||||||
|
|
||||||
Uses:
|
|
||||||
- flip_columns
|
|
||||||
- flip_lines
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout_strategies.horizontal() *layout_strategies.horizontal()*
|
|
||||||
Horizontal previewer
|
|
||||||
|
|
||||||
+-------------+--------------+
|
|
||||||
| | |
|
|
||||||
| Results | |
|
|
||||||
| | Preview |
|
|
||||||
| | |
|
|
||||||
+-------------| |
|
|
||||||
| Prompt | |
|
|
||||||
+-------------+--------------+
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout_strategies.vertical() *layout_strategies.vertical()*
|
layout_strategies.vertical() *layout_strategies.vertical()*
|
||||||
Vertical perviewer stacks the items on top of each other.
|
Vertical perviewer stacks the items on top of each other.
|
||||||
|
|
||||||
@@ -581,5 +570,16 @@ layout_strategies.vertical() *layout_strategies.vertical()*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
layout_strategies.flex() *layout_strategies.flex()*
|
||||||
|
Swap between `horizontal` and `vertical` strategies based on the window
|
||||||
|
width
|
||||||
|
- Supports `vertical` or `horizontal` features
|
||||||
|
|
||||||
|
Uses:
|
||||||
|
- flip_columns
|
||||||
|
- flip_lines
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ function actions.close_pum(_)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local do_close = function(prompt_bufnr, keepinsert)
|
actions._close = function(prompt_bufnr, keepinsert)
|
||||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
local prompt_win = state.get_status(prompt_bufnr).prompt_win
|
local prompt_win = state.get_status(prompt_bufnr).prompt_win
|
||||||
local original_win_id = picker.original_win_id
|
local original_win_id = picker.original_win_id
|
||||||
@@ -217,7 +217,7 @@ local do_close = function(prompt_bufnr, keepinsert)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function actions.close(prompt_bufnr)
|
function actions.close(prompt_bufnr)
|
||||||
do_close(prompt_bufnr, false)
|
actions._close(prompt_bufnr, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
actions.edit_command_line = function(prompt_bufnr)
|
actions.edit_command_line = function(prompt_bufnr)
|
||||||
@@ -276,7 +276,7 @@ end
|
|||||||
actions.run_builtin = function(prompt_bufnr)
|
actions.run_builtin = function(prompt_bufnr)
|
||||||
local entry = action_state.get_selected_entry(prompt_bufnr)
|
local entry = action_state.get_selected_entry(prompt_bufnr)
|
||||||
|
|
||||||
do_close(prompt_bufnr, true)
|
actions._close(prompt_bufnr, true)
|
||||||
require('telescope.builtin')[entry.text]()
|
require('telescope.builtin')[entry.text]()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user