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

Allow table as additional args in live grep and grep string #2139

Merged
merged 4 commits into from
Oct 24, 2022

Conversation

gepbird
Copy link
Contributor

@gepbird gepbird commented Aug 19, 2022

Description

Currently you need to wrap additional arguments for live grep (and grep string) in a function that returns a table. This PR allows using just a table too.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Minimal config:

require 'telescope'.setup {
  defaults = {
    vimgrep_arguments = { 'rg', '--column' }
  }
}

Have hidden and non-hidden files in the current working directory. Open live grep with the options specified in the following tests.
Search for a hidden file to test if telescope used the specified options for grepping.

  • Using a function for additional args still works
require 'telescope.builtin'.live_grep {
  additional_args = function(opts) return { '--hidden' } end
}
  • Using a table for additional args now works
require 'telescope.builtin'.live_grep {
  additional_args = { '--hidden' }
}

Test are identical for grep_string.

Configuration:

  • Neovim version (nvim --version): v0.8.0-dev-788-g0fdf59ac9
  • Operating system and version: arch linux 5.19.1-arch2-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)

@gepbird gepbird marked this pull request as ready for review August 19, 2022 22:35
@Conni2461
Copy link
Member

sorry for the long wait. I rebased it and generated vimdocs.

Thanks :)

@Conni2461 Conni2461 merged commit 5c7db40 into nvim-telescope:master Oct 24, 2022
@gepbird gepbird deleted the livegrep-table branch October 24, 2022 09:54
Conni2461 pushed a commit that referenced this pull request Jan 6, 2023
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.

None yet

2 participants