From a4dc3a953586e70d12a401385f3ce516d2d27d37 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 7 Apr 2018 15:12:40 +0200 Subject: tabs_grep.vim: Trouble with line continuations; reorder arguments `s:MatchString()` needs to have the search string as its first argument, because that's how it will get passed in when referenced above as: call filter(tabs, function('s:MatchString', [a:search])) Also had some trouble getting the line continuation to work on the `return`, so had a few experiments messing with that trying to get it to work. --- plugin/tabs_grep.vim | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/plugin/tabs_grep.vim b/plugin/tabs_grep.vim index 35a00fa..f7ce1b2 100644 --- a/plugin/tabs_grep.vim +++ b/plugin/tabs_grep.vim @@ -20,9 +20,22 @@ function! TabsGrep(search) " echo filtered_tabs endfunction -function! s:MatchString(index, value, search) - return match(a:value, a:search) != -1 || - \ match(a:value, '\vTab page \d+') != -1 +function! s:MatchString(search, index, value) + " let matched = match(a:value, a:search) != -1 || + " \ match(a:value, '\vTab page \d+') != -1 + " let matched = 0 + " \ || 1 + " return matched + " return ( + " \ + " \ match(a:value, '\vTab page \d+') != -1 + " \ ) + " return match(a:value, a:search) != -1 || + " \ match(a:value, '\vTab page \d+') != -1 + echo 'test' + echo a:search + return 0 || + \ 1 endfunction command! -nargs=1 TabsGrep :call TabsGrep() -- cgit v1.2.3