diff options
author | Rory Bradford <roryrjb@gmail.com> | 2020-10-10 10:22:39 +0100 |
---|---|---|
committer | Rory Bradford <roryrjb@gmail.com> | 2020-10-10 10:22:39 +0100 |
commit | a40bd8adb20715582813fb8399dd37e4efee9b37 (patch) | |
tree | b24cb66671e5540f1ab28fc5497c3eb0bf0cada7 /contrib/vim/plugin | |
parent | 1c5aba7f1b2a53cdcaf896df118f3c7b42c0251c (diff) | |
download | rf-a40bd8adb20715582813fb8399dd37e4efee9b37.tar.gz |
Improve Vim integration
Signed-off-by: Rory Bradford <roryrjb@gmail.com>
Diffstat (limited to 'contrib/vim/plugin')
-rw-r--r-- | contrib/vim/plugin/rf.vim | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/contrib/vim/plugin/rf.vim b/contrib/vim/plugin/rf.vim index cf4649b..4ea281c 100644 --- a/contrib/vim/plugin/rf.vim +++ b/contrib/vim/plugin/rf.vim @@ -3,6 +3,7 @@ if exists('loaded_rf') endif let loaded_rf = 1 +let g:rf_prefix = "" set errorformat+=%f @@ -60,15 +61,26 @@ function! g:RFPrompt() echo "RF: " . l:rf_pattern redraw - let results = system('rf -ws -- ' . shellescape(l:rf_pattern)) + if len(g:rf_prefix) + let results = system('rf -l9 -d ' . shellescape(g:rf_prefix) . ' -s -- ' . shellescape(l:rf_pattern)) + else + let results = system('rf -l9 -ws -- ' . shellescape(l:rf_pattern)) + endif + let results_list = split(results, '\n') let l:rf_results = results_list if len(results_list) > 0 - cgete results | copen 9 + if len(results_list) < 9 + execute "cgete results | copen " . len(results_list) + else + cgete results | copen 9 + endif + redraw else cexpr [] + cclose endif else let l:rf_cmd = 0 |