- Notifications
You must be signed in to change notification settings - Fork116
Example for updating and adding cscope
Linwei edited this pageOct 26, 2016 ·1 revision
Modify the code below to fit your need:
function!g:CscopeDone()exec"cs add".fnameescape(g:asyncrun_text)endfuncfunction!g:CscopeUpdate(workdir, cscopeout)letl:cscopeout=fnamemodify(a:cscopeout,":p")letl:cscopeout=fnameescape(l:cscopeout)letl:workdir= (a:workdir=='')?'.' :a:workdirtry |exec"cs kill".l:cscopeout |catch |endtryexec"AsyncRun -post=call\\ g:CscopeDone()".\"-text=".l:cscopeout.""\"-cwd=".fnameescape(l:workdir)."".\"cscope -b -R -f".l:cscopeoutendfuncnoremap<F11>:call g:CscopeUpdate(".", "cscope.out")<cr>
And then you can have your F11 to update cscope files in background.
key points:
- use
-postto define a piece of vimscript which will be executed after job is finished - use
-textto pass a text object tog:asyncrun_textwhen job is finished.