Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pickers): add an option to resume and select the entry #3394

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

delphinus
Copy link
Member

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.

  1. :Telescope find_files
  2. open the file: /path/to/cwd/foo-01.txt
  3. :Telescope resume
  4. move the cursor with <C-n> (move_selection_next) to select the file: /path/to/cwd/foo-02.txt
  5. open it with <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.

  1. :Telescope find_files
  2. open the file: /path/to/cwd/foo-01.txt
  3. :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.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added test case in lua/tests/automated/pickers/resume_spec.lua. This does tests below.

  • Open :Telecsope find_files, input .md, select and open with <CR>, and it shows README.md.
  • Do :Telescope resume select_pos=1, then it shows developers.md.
  • Do :Telescope resume select_pos=1, then it shows CONTRIBUTING.md.
  • Do :Telescope resume select_pos=-1, then it shows developers.md .
  • Do :Telescope resume select_pos=-1, then it shows README.md .
  • Do :Telescope resume select_pos=2, then it shows CONTRIBUTING.md.

Configuration:

  • Neovim version (nvim --version): NVIM v0.11.0-dev-4602+g9d114b7205-Homebrew
  • Operating system and version: macOS Sequoia 15.1.1

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@delphinus delphinus force-pushed the feat/resume-and-select branch 2 times, most recently from 89df487 to dc13bf2 Compare January 3, 2025 14:41
@delphinus delphinus force-pushed the feat/resume-and-select branch from 67a3df5 to 17cdf78 Compare January 8, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resume picker and select next/prev entry and open it automatically
1 participant