From 24812166ac73e3a4bef7f09a82d02048f9ec7dbd Mon Sep 17 00:00:00 2001 From: gleachkr Date: Thu, 3 Jul 2014 09:48:14 -0700 Subject: [PATCH] Slight improvement of ag wrapper, to list file contexts BEFORE the filename in the list passed to fzf --- examples.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples.md b/examples.md index 921756a..0715d7e 100644 --- a/examples.md +++ b/examples.md @@ -150,14 +150,18 @@ add this to your .vimrc ```vimL command! -nargs=1 AgFZF call fzf#run({ - \'source': 'ag -i ' . , + \'source': Arghandler(), \'sink' : function('AgHandler'), \'options' : '-m' \}) function! AgHandler(l) let keys = split(a:l,':') - execute 'tabe +' . keys[1] . ' ' . keys[0] + execute 'tabe +' . keys[-2] . ' ' . keys[-1] +endfunction + +function! Arghandler(l) + return "ag -i " . a:l . " | sed 's@\\(.[^:]*\\):\\(.[^:]*\\):\\(.*\\)@\\3:\\2:\\1@' " endfunction ```