Permalink
Browse files

allow searching with list-return through copen

Includes the following new commands:

  - SWSearchList which search the same way as SWSearch does
    but directly presents the user with a list of matches
    through copen (quickfix-list).
  - SWSL is an alias for SWSearchList
  - directly add SWS as alias for SWSearch to prevent
    ambiguous commands.
  • Loading branch information...
1 parent 6000abf commit 1691127f0ab095fc2048bdb2d924fb2bcd3ffb09 @0robustus1 0robustus1 committed Jan 25, 2014
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/soywiki.vim
View
@@ -570,13 +570,16 @@ func! s:insert_divider()
endfunc
"------------------------------------------------------------------------
" SEARCH
-func! s:wiki_search(pattern, in_this_namespace)
+func! s:wiki_search(pattern, in_this_namespace, display_list)
let pattern = (empty(a:pattern) ? @/ : a:pattern)
if a:in_this_namespace
execute printf('vimgrep/\c%s/ %s', pattern, s:page_namespace()."/*")
else
execute printf('vimgrep/\c%s/ %s', pattern, "*/*")
endif
+ if a:display_list
+ execute 'copen'
+ endif
endfunc
"------------------------------------------------------------------------
@@ -682,8 +685,11 @@ func! s:global_mappings()
command! -bar -nargs=1 -range -complete=file SWLinkAppend :<line1>,<line2>call s:extract(<f-args>, 'append', 1)
command! -bar -nargs=1 -range -complete=file SWLinkInsert :<line1>,<line2>call s:extract(<f-args>, 'insert', 1)
- command! -bar -nargs=1 SWSearch :call s:wiki_search(<f-args>, 0)
- command! -bar -nargs=1 SWNamespaceSearch :call s:wiki_search(<f-args>, 1)
+ command! -bar -nargs=1 SWSearch :call s:wiki_search(<f-args>, 0, 0)
+ command! -bar -nargs=1 SWS SWSearch <args>
+ command! -bar -nargs=1 SWSearchList :call s:wiki_search(<f-args>, 0, 1)
+ command! -bar -nargs=1 SWSL SWSearchList <args>
+ command! -bar -nargs=1 SWNamespaceSearch :call s:wiki_search(<f-args>, 1, 0)
autocmd BufReadPost,BufNewFile,WinEnter,BufEnter,BufNew,BufAdd * call s:highlight_wikiwords()
autocmd BufReadPost,BufNewFile,WinEnter,BufEnter,BufNew,BufAdd * call s:prep_buffer()

0 comments on commit 1691127

Please sign in to comment.