diff --git a/README.md b/README.md index 1b83132..aed1af4 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ This Vim plugin is built on top of the great tool [CodeQuery](https://github.com > * Use Vim8's new features to enhance usability. > * ~~Do lazy-loading.~~ > * Test it. +> * Doc it. > > Completeness: 92% > Current Version: v0.8 @@ -100,17 +101,15 @@ echo mkdir mv cut find awk stat git(optional) * Use your favorite plugins manager: [pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [Plug](https://github.com/junegunn/vim-plug), [NeoBundle](https://github.com/Shougo/neobundle.vim), [Dein](https://github.com/Shougo/dein.vim), ... * Take Plug as an example: ```vim -" Recommemded => it helps vim-codequery to build DB asynchrously without blocking Vim -Plug 'tpope/vim-dispatch' - -" Recommemded => if you don't have an :Ack (or :Ag) liked command => install it ! -Plug 'mileszs/ack.vim' - -" Highly Recommemded => if you want to use my custom Unite menu -Plug 'Shougo/unite.vim' - -" The Must Have One +" Required +Plug 'Shougo/unite.vim' Plug 'devjoe/vim-codequery' + +" Optional (if your vim version < 8.0) +Plug 'tpope/vim-dispatch' + +" Optional (if you don't have an :Ack (or :Ag) liked command) +Plug 'mileszs/ack.vim' ```
diff --git a/autoload/codequery.vim b/autoload/codequery.vim index ca95057..0ad89fb 100644 --- a/autoload/codequery.vim +++ b/autoload/codequery.vim @@ -130,17 +130,24 @@ function! codequery#make_codequery_db(args) abort continue endif - " TODO: Rewrite it when Vim8 is coming - " ---------------------------------------------------------------- - if exists(':Start') + if v:version >= 800 + echom 'Making ...' + let mydict = {'db_path': db_path, + \'callback': function("codequery#db#make_db_callback")} + let options = {'out_io': 'null', + \'exit_cb': mydict.callback} + let s:build_job = job_start(['/bin/sh', '-c', shell_cmd], options) + let timer = timer_start(500, + \{-> execute("call job_status(s:build_job)","")}, + \{'repeat': 60}) + elseif exists(':Start') silent execute 'Start! -title=Make_CodeQuery_DB -wait=error ' . shell_cmd redraw! - echom 'Making ' . db_path ' => Run :CodeQueryViewDB to Check Status' + echom 'Making ... ' . db_path ' => Run :CodeQueryViewDB to Check Status' else silent execute '!' . shell_cmd redraw! endif - " ---------------------------------------------------------------- endfor call s:restore_cwd() endfunction diff --git a/autoload/codequery/db.vim b/autoload/codequery/db.vim index 341af37..3801e69 100644 --- a/autoload/codequery/db.vim +++ b/autoload/codequery/db.vim @@ -36,6 +36,11 @@ function! codequery#db#find_db_path(filetype) abort endfunction +function! codequery#db#make_db_callback(job, status) dict + echom 'Done! (' . self.db_path . ')' +endfunction + + function! codequery#db#construct_python_db_build_cmd(db_path) abort let find_cmd = 'find . -iname "*.py" > python_cscope.files' let pycscope_cmd = 'pycscope -f "python_cscope.out" -i python_cscope.files'