[Proposal] Completion for the Ag command
- Dominant language
- Vim Script
- Stars
- 10.3k
- Forks
- 608
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 2
Description
- Category
- [ ] Question
- [ ] Bug
- [x] Suggestion
## Proposal
After thinking for a (long) while thinking about the problem of interactive search
with `:Ag`, after a [first proposal](https://github.com/junegunn/fzf/issues/1211) on how to implement it, I believe the way to support something like that is to implement a custom wildmenu completion for the command.
I think it fits the vim philosophy quite nicely, as it uses vim native features and works in the way a user would expect it to.
## POC implementation
Here's my first attempt to implement something like this.
```vim
fun! CompleteAg(A,L,P)
if a:A == ''
return a:A
endif
return system("ag -o " . shellescape('\b\w*' . a:A . '\w*\b') . ' | cut -d":" -f3- | sort -u')
endfun
command! -bang -complete=custom,CompleteAg -nargs=* Ag call fzf#vim#ag(, 0)
```
## Demo
Using the implementation above in the `fzf.vim` project
[](https://asciinema.org/a/Xfdw74uzRJyju9zWrJ10UVcOQ)
Thoughts?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.