feat(pickers): add an option to resume and select the entry #3394
+72
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This introduces a feature to select and open an entry immediately after opening
:Telescope resume
. This will be used this situation below.For example, consider this situation below.
:Telescope find_files
/path/to/cwd/foo-01.txt
:Telescope resume
<C-n>
(move_selection_next
) to select the file:/path/to/cwd/foo-02.txt
<CR>
(select_default
)I want to do
:Telescope resume
and<C-n>
and<CR>
with one key mapping. With this PR, I can do that.:Telescope find_files
/path/to/cwd/foo-01.txt
:Telescope resume select_pos=1
This will open the next entry:
/path/to/cwd/foo-02.txt
.Fixes #3391
FYI: I borrowed this idea from Shougo's products: unite.vim, denite.nvim, and ddc.vim.
:UniteNext
/:UnitePrev
.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Added test case in
lua/tests/automated/pickers/resume_spec.lua
. This does tests below.:Telecsope find_files
, input.md
, select and open with<CR>
, and it showsREADME.md
.:Telescope resume select_pos=1
, then it showsdevelopers.md
.:Telescope resume select_pos=1
, then it showsCONTRIBUTING.md
.:Telescope resume select_pos=-1
, then it showsdevelopers.md
.:Telescope resume select_pos=-1
, then it showsREADME.md
.:Telescope resume select_pos=2
, then it showsCONTRIBUTING.md
.Configuration:
NVIM v0.11.0-dev-4602+g9d114b7205-Homebrew
Checklist: