Have 2 different Ag functions
- Dominant language
- Vim Script
- Stars
- 10.3k
- Forks
- 608
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 2
Description
- Category
- [x] Question
- [ ] Bug
- [ ] Suggestion
- OS
- [x] Linux
- [x] macOS
- [ ] Windows
- [ ] Etc.
- Vim
- [x] Vim
- [ ] Neovim
I'm trying to make fzf find files with the exact name of what I have highlighted (handy for react components).
I already have this snippet that lets me search files for the string I have marked:
```
vnoremap s "hy:Ag h
command! -bang -nargs=* Ag call fzf#vim#ag(, {'options': '--delimiter : --nth 4..'}, 0)
```
So I basically use visual mode, mark something, then I use the mapping which copies the marked content into the named register h, and then passes it on to Ag. My regular Ag is set to not show multiple hits per file. Thats all fine.
My new approach is to make another configuration for Ag which basically only searches for filenames but not for the content. I want to use the same binding from above but with a capital S. I know that I need to pass `-g` as an argument to ag to search for files only. I renamed Ag to Agf.
```
vnoremap S "hy:Agf h
command! -bang -nargs=* Agf call fzf#vim#ag(, {'options': '-g'}, 0)
```
I always get an error:
```
Error running ( ag --nogroup --column --color 'command' )|'fzf' '--ansi' '--prompt' 'Ag> ' '--multi' '--bind' 'alt-a:selec
t-all,alt-d:deselect-all' '--color' 'hl:4,hl+:12' -g --expect=ctrl-v,ctrl-x,ctrl-t --height=13 > /tmp/vratIVA/107
Press ENTER or type command to continue
```
Does anyone understand whats going on?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.