-
-
Notifications
You must be signed in to change notification settings - Fork 804
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
Ability to quickly include/exclude certain directories when doing live_grep #2215
Comments
uff, i am not sure we want additional floating windows, this could make the ui extremely cluttered. Also tab is already mapped. Another thing that might make this really hard to implement is different telescope layouts/themes, or preview toggling ... anything that changes the frontend windows positions ... We might wanna ping https://github.com/nvim-telescope/telescope-live-grep-args.nvim maintainer @weeman1337 My proposal would be to do this all in one prompt. Like introduce a new syntax to include and exclude directory, similar to what fzf has with With live-grep-args you can also just write rg options at the beginning of the prompt, maybe that helps you more. Idk its a though issue |
Someone called my name? 😆 I can just talk for „live grep args“ and that it allows @dlvhdr to do exactly what he wants. You can easily pass the glob option there. I wouldn't hide it behind some crazy / magic prompt parsing and just pass the args: keep things simple. |
This works for me :) @weeman1337 thanks for stopping by! When I search for Screen.Recording.2022-11-01.at.21.28.12.mov |
Here are some examples (using
All that can be supported by shortcut commands, like mentioned in the doc. |
Thanks, this appears to work great. 💖 |
Sorry to post almost one year later but I was super confused as to how I could make this work so here it is for the next lost soul, a minimal config to get you started on the right path: -- lazy-nvim.lua
{
"nvim-telescope/telescope.nvim",
tag = "0.1.2",
dependencies = {
"nvim-telescope/telescope-live-grep-args.nvim",
-- your other deps
},
config = function()
require("telescope").load_extension("live_grep_args")
end
}, -- telescope.lua
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
-- ... rest of your config
-- Whatever keymap you want
vim.keymap.set("n", "<leader>lg", function()
telescope.extensions.live_grep_args.live_grep_args()
end) |
@ZyriabDsgn technically it should be closer to this {
"nvim-telescope/telescope.nvim",
tag = "0.1.3", -- latest tag
dependencies = {
"nvim-lua/plenary.nvim", -- telescope dependency
"nvim-telescope/telescope-live-grep-args.nvim",
-- your other deps
},
config = function()
require("telescope").setup() -- setup
require("telescope").load_extension("live_grep_args")
end
}, |
I actually discovered you can do |
Thanks guys. |
Is your feature request related to a problem? Please describe.
This is a feature I keep finding myself missing from VSCode.
Basically, when doing a live_grep, I would like to be presented with 2 additional input boxes for including or excluding directories.
Describe the solution you'd like
![image](https://user-images.githubusercontent.com/6196971/198904620-e67d12d7-9aa7-44ac-bb5c-f81c288211da.png)
I guess this could be done by writing some custom lua code to ask the user for 2 inputs and then opening telescope but I think this has the disadvantage of being disconnected from the telescope UI.
This solution allows me to easily see and edit, in the context of my search, which dirs are being searched in.
This solution, should allow moving between the 3 input boxes with some kind of keybinding, like Tab.
The solution can pass the arguments to
rg
directly.Note: this can also be done with one additional input box, where exclusions begin with
!
Describe alternatives you've considered
Using something like #2201, which addresses some use cases, but not all, and also not as convenient as what I'm suggesting.
Additional context
I usually use this to exclude tests files on the fly, include only a certain package in a monorepo, exclude yarn.lock etc.
The text was updated successfully, but these errors were encountered: