nvim-telescope / telescope-live-grep-args.nvim

Live grep with args
726 stars 40 forks source link

grep_visual_selection should support passing format options #78

Closed kevindashgit closed 5 months ago

kevindashgit commented 8 months ago

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 }
weeman1337 commented 5 months ago

Can you list the options you want grep_visual_selection to forward?

kevindashgit commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

Closed by https://github.com/nvim-telescope/telescope-live-grep-args.nvim/pull/82