Run commands in given working directory

This commit is contained in:
Karl Yngve Lervåg 2014-07-27 21:51:08 +02:00
parent 54425a7d40
commit 75cd19b268
2 changed files with 14 additions and 8 deletions

View File

@ -159,17 +159,11 @@ function! s:bibtex_search(regexp) " {{{1
\ '\bibdata{' . bibdata . '}', \ '\bibdata{' . bibdata . '}',
\ ], tmp.aux) \ ], 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 " Create the temporary bbl file
let exe = {} let exe = {}
let exe.cmd = cmd let exe.cmd = 'bibtex -terse ' . tmp.aux
let exe.bg = 0 let exe.bg = 0
let exe.wd = g:latex#data[b:latex.id].root
call latex#util#execute(exe) call latex#util#execute(exe)
" Parse temporary bbl file " Parse temporary bbl file

View File

@ -100,6 +100,7 @@ function! latex#util#execute(exe) " {{{1
" exe.cmd String String that contains the command to run " exe.cmd String String that contains the command to run
" exe.bg 0 or 1 Run in background or not " exe.bg 0 or 1 Run in background or not
" exe.null 0 or 1 Send output to /dev/null " exe.null 0 or 1 Send output to /dev/null
" exe.wd String Run command in provided working directory
" "
" Only exe.cmd is required. " 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 bg = has_key(a:exe, 'bg') ? a:exe.bg : 1
let null = has_key(a:exe, 'null') ? a:exe.null : 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 " Set up command string based on the given system
if has('win32') if has('win32')
if bg if bg
@ -135,6 +142,11 @@ function! latex#util#execute(exe) " {{{1
silent execute cmd silent execute cmd
" Return to previous working directory
if has_key(a:exe, 'wd')
execute 'lcd ' . pwd
endif
if !has("gui_running") if !has("gui_running")
redraw! redraw!
endif endif