Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve verbose output & timing for keyword searches

  • Loading branch information...
commit 6107bdf427e8ff0ecb971d7327de3e9a4bc185fb 1 parent 8f82c18
@xolox authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 autoload/xolox/notes.vim
View
10 autoload/xolox/notes.vim
@@ -6,7 +6,7 @@
" Note: This file is encoded in UTF-8 including a byte order mark so
" that Vim loads the script using the right encoding transparently.
-let g:xolox#notes#version = '0.17.6'
+let g:xolox#notes#version = '0.17.7'
let s:scriptdir = expand('<sfile>:p:h')
call xolox#misc#compat#check('notes', 1)
@@ -673,6 +673,7 @@ endfunction
function! s:vimgrep_wrapper(bang, pattern, files) " {{{2
" Search for {pattern} in {files} using :vimgrep.
+ let starttime = xolox#misc#timer#start()
let args = map(copy(a:files), 'fnameescape(v:val)')
call insert(args, a:pattern . 'j')
let s:swaphack_enabled = 1
@@ -680,6 +681,7 @@ function! s:vimgrep_wrapper(bang, pattern, files) " {{{2
let ei_save = &eventignore
set eventignore=syntax,bufread
execute 'vimgrep' . a:bang join(args)
+ call xolox#misc#timer#stop("notes.vim %s: Populated quick-fix window in %s.", g:xolox#notes#version, starttime)
finally
let &eventignore = ei_save
unlet s:swaphack_enabled
@@ -697,8 +699,10 @@ endfunction
function! s:run_scanner(keywords, matches) " {{{2
" Try to run scanner.py script to find notes matching {keywords}.
+ call xolox#misc#msg#info("notes.vim %s: Searching notes using keyword index ..", g:xolox#notes#version)
let lines = s:python_command(a:keywords)
if type(lines) == type([])
+ call xolox#misc#msg#debug("notes.vim %s: Search script reported %i matching note%s.", g:xolox#notes#version, len(lines), len(lines) == 1 ? '' : 's')
call extend(a:matches, lines)
return 1
endif
@@ -718,7 +722,7 @@ function! s:python_command(...) " {{{2
let script = xolox#misc#path#absolute(g:notes_indexscript)
let python = executable('python2') ? 'python2' : 'python'
if !(executable(python) && filereadable(script))
- call xolox#misc#msg#debug("notes.vim %s: The %s script isn't executable.", g:xolox#notes#version, script)
+ call xolox#misc#msg#debug("notes.vim %s: We can't execute the %s script!", g:xolox#notes#version, script)
else
let options = ['--database', g:notes_indexfile, '--notes', g:notes_directory]
if &ignorecase
@@ -735,9 +739,11 @@ function! s:python_command(...) " {{{2
call xolox#misc#msg#warn("notes.vim %s: Search script failed with output: %s", g:xolox#notes#version, output)
else
let lines = split(output, "\n")
+ call xolox#misc#msg#debug("notes.vim %s: Search script output: %s", g:xolox#notes#version, string(lines))
if !empty(lines) && lines[0] == 'Python works fine!'
return lines[1:]
endif
+ call xolox#misc#msg#debug("notes.vim %s: Search script returned invalid output :-(", g:xolox#notes#version)
endif
endif
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.