Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
```

<br>
Expand Down
17 changes: 12 additions & 5 deletions autoload/codequery.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions autoload/codequery/db.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down