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

grep_visual_selection should support passing format options #78

Closed
kevindashgit opened this issue Mar 6, 2024 · 4 comments
Closed

grep_visual_selection should support passing format options #78

kevindashgit opened this issue Mar 6, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@kevindashgit
Copy link

I'm trying to leverage the grep_visual_selection function to grep based on a selection in a given buffer.
However, I work in a very deeply pathed project such that I cannot see the full file paths of the options presented.

I want to be able to either shorten the paths when that case arises, or modify how the preview is presented or whatever it takes so that I can see both the preview and the full file paths.

Here is what I'm using now as a mapping:

vim.keymap.set('v', '<leader>*', '<cmd>lua require("telescope-live-grep-args.shortcuts").grep_visual_selection()<cr>') 

and here's how I have telescope-live-grep-args configured in my init.lua

   47 require('telescope').setup {
   48   
   49   
   50   -- ... stuff here ...
   51    
   52   
   53   extensions = {
   54     
   55     -- .... stuff here ...
   56     
   57     live_grep_args = {
   58       auto_quoting = true, -- enable/disable auto-quoting
   59       -- define mappings, e.g.
   60       mappings = { -- extend mappings
   61         i = {
   62           ["<C-k>"] = lga_actions.quote_prompt(),
   63           ["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
   64         },
   65       },
   66       
   67       theme = "dropdown", -- use dropdown theme
   68       
   69       
   70       layout_config = {
   71         prompt_position = "bottom",
   72         preview_cutoff = 80,
   73       }
   74
   75     }
   76   }
   77 }
@kevindashgit kevindashgit added the enhancement New feature or request label Mar 6, 2024
@weeman1337
Copy link
Collaborator

Can you list the options you want grep_visual_selection to forward?

@kevindashgit
Copy link
Author

In the description you can see that I have some defaults set for things like layout_config and theme. It would be awesome to be able to pass these in as args to override these defaults for a given invocation of grep_visual_selection

@PrayagS
Copy link

PrayagS commented Jun 1, 2024

Can you list the options you want grep_visual_selection to forward?

search_dirs or grep_open_files would be a good start. That way I can have two visual mode keymaps; one for searching selection in open files and one for searching across the whole project.

Right now I can only do the latter out of the box.

@weeman1337
Copy link
Collaborator

Closed by #82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants