6
6
" Note: This file is encoded in UTF-8 including a byte order mark so
7
7
" that Vim loads the script using the right encoding transparently.
8
8
9
- let g: xolox #notes#version = ' 0.33.2 '
9
+ let g: xolox #notes#version = ' 0.33.3 '
10
10
let g: xolox #notes#url_pattern = ' \<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
11
11
let s: scriptdir = expand (' <sfile>:p:h' )
12
12
@@ -482,12 +482,14 @@ function! xolox#notes#search(bang, input) " {{{1
482
482
endif
483
483
endif
484
484
if input = ~ ' ^/.\+/$'
485
+ call xolox#misc#msg#debug (" notes.vim %s: Performing pattern search (%s) .." , g: xolox #notes#version , input )
485
486
call s: internal_search (a: bang , input , ' ' , ' ' )
486
487
call s: set_quickfix_title ([], input )
487
488
else
488
489
let keywords = split (input )
489
490
let all_keywords = s: match_all_keywords (keywords)
490
491
let any_keyword = s: match_any_keyword (keywords)
492
+ call xolox#misc#msg#debug (" notes.vim %s: Performing keyword search (%s) .." , g: xolox #notes#version , input )
491
493
call s: internal_search (a: bang , all_keywords, input , any_keyword)
492
494
if &buftype == ' quickfix'
493
495
" Enable line wrapping in the quick-fix window.
@@ -696,10 +698,12 @@ function! s:internal_search(bang, pattern, keywords, phase2) " {{{2
696
698
let notes = []
697
699
let phase2_needed = 1
698
700
if a: keywords != ' ' && s: run_scanner (a: keywords , notes)
701
+ call xolox#misc#msg#debug (" notes.vim %s: Skipping phase 1 search (performed using Python script) .." , g: xolox #notes#version )
699
702
if a: phase2 != ' '
700
703
let pattern = a: phase2
701
704
endif
702
705
else
706
+ call xolox#misc#msg#debug (" notes.vim %s: Performing phase 1 search to gather matching notes .." , g: xolox #notes#version )
703
707
call s: vimgrep_wrapper (a: bang , a: pattern , xolox#notes#get_fnames (0 ))
704
708
let notes = s: qflist_to_filenames ()
705
709
if a: phase2 != ' '
@@ -717,7 +721,12 @@ function! s:internal_search(bang, pattern, keywords, phase2) " {{{2
717
721
" search using :vimgrep we need to run :vimgrep another time to get the
718
722
" quick-fix list in the right format :-|
719
723
if phase2_needed
724
+ call setqflist ([])
725
+ call xolox#misc#msg#debug (" notes.vim %s: Performing phase 2 search to populate quick-fix window .." , g: xolox #notes#version )
720
726
call s: vimgrep_wrapper (a: bang , pattern, notes)
727
+ if ! empty (notes) && empty (getqflist ())
728
+ throw " Failed to populate quick-fix window! Looks like you're being bitten by this bug: https://github.com/xolox/vim-notes/issues/53"
729
+ endif
721
730
endif
722
731
if a: bang == ' ' && bufnr (' %' ) != bufnr_save
723
732
" If :vimgrep opens the first matching file while &eventignore is still
@@ -737,8 +746,8 @@ function! s:vimgrep_wrapper(bang, pattern, files) " {{{2
737
746
let args = map (copy (a: files ), ' fnameescape(v:val)' )
738
747
call insert (args , a: pattern . ' j' )
739
748
let s: swaphack_enabled = 1
749
+ let ei_save = &eventignore
740
750
try
741
- let ei_save = &eventignore
742
751
set eventignore = syntax ,bufread
743
752
let command = printf (' vimgrep%s %s' , a: bang , join (args ))
744
753
call xolox#misc#msg#debug (" notes.vim %s: Populating quick-fix window using command: %s" , g: xolox #notes#version , command )
0 commit comments