mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 09:33:42 -05:00
A little FZF powered ag wrapper for vim.
20
examples.md
20
examples.md
@@ -142,3 +142,23 @@ fo() {
|
||||
[ -n "$file" ] && open "$file"
|
||||
}
|
||||
```
|
||||
|
||||
narrow ag results within vim
|
||||
----
|
||||
|
||||
add this to your .vimrc
|
||||
|
||||
```vimL
|
||||
command! -nargs=1 AgFZF call fzf#run({
|
||||
\'source': 'ag -i ' . <f-args>,
|
||||
\'sink' : function('AgHandler'),
|
||||
\'options' : '-m'
|
||||
\})
|
||||
|
||||
function! AgHandler(l)
|
||||
let keys = split(a:l,':')
|
||||
execute 'tabe +' . keys[1] . ' ' . keys[0]
|
||||
endfunction
|
||||
```
|
||||
|
||||
Then use `:AgFZF` followed by an ag-recogizable regex to pipe ag results into FZF for narrowing. Selected results are opened in new tabs so that you can open multiple positions within the same file (perhaps there's a better way of doing this).
|
||||
Reference in New Issue
Block a user