m/fzf
1
0
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.

gleachkr
2014-07-03 08:27:34 -07:00
parent e0d19586c4
commit 1bf2d2d839

@@ -141,4 +141,24 @@ fo() {
file=$(fzf --query="$1" --select-1 --exit-0)
[ -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).