Run commands in given working directory
This commit is contained in:
parent
54425a7d40
commit
75cd19b268
@ -159,17 +159,11 @@ function! s:bibtex_search(regexp) " {{{1
|
||||
\ '\bibdata{' . bibdata . '}',
|
||||
\ ], tmp.aux)
|
||||
|
||||
" Define the bibtex command that is used to create the bbl file.
|
||||
" Note: Special care is needed on windows
|
||||
let cmd = 'bibtex -terse ' . tmp.aux
|
||||
if has('win32')
|
||||
let cmd = 'cd ' . g:latex#data[b:latex.id].root . ' & ' . cmd
|
||||
endif
|
||||
|
||||
" Create the temporary bbl file
|
||||
let exe = {}
|
||||
let exe.cmd = cmd
|
||||
let exe.cmd = 'bibtex -terse ' . tmp.aux
|
||||
let exe.bg = 0
|
||||
let exe.wd = g:latex#data[b:latex.id].root
|
||||
call latex#util#execute(exe)
|
||||
|
||||
" Parse temporary bbl file
|
||||
|
@ -100,6 +100,7 @@ function! latex#util#execute(exe) " {{{1
|
||||
" exe.cmd String String that contains the command to run
|
||||
" exe.bg 0 or 1 Run in background or not
|
||||
" exe.null 0 or 1 Send output to /dev/null
|
||||
" exe.wd String Run command in provided working directory
|
||||
"
|
||||
" Only exe.cmd is required.
|
||||
"
|
||||
@ -113,6 +114,12 @@ function! latex#util#execute(exe) " {{{1
|
||||
let bg = has_key(a:exe, 'bg') ? a:exe.bg : 1
|
||||
let null = has_key(a:exe, 'null') ? a:exe.null : 1
|
||||
|
||||
" Change directory if wanted
|
||||
if has_key(a:exe, 'wd')
|
||||
let pwd = getcwd()
|
||||
execute 'lcd ' . a:exe.wd
|
||||
endif
|
||||
|
||||
" Set up command string based on the given system
|
||||
if has('win32')
|
||||
if bg
|
||||
@ -135,6 +142,11 @@ function! latex#util#execute(exe) " {{{1
|
||||
|
||||
silent execute cmd
|
||||
|
||||
" Return to previous working directory
|
||||
if has_key(a:exe, 'wd')
|
||||
execute 'lcd ' . pwd
|
||||
endif
|
||||
|
||||
if !has("gui_running")
|
||||
redraw!
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user