issue 4 is neatly fixed, by storing the formatprg in a buffer local

variable, and reloading it on BufEnter,WinEnter
This commit is contained in:
Chiel92 2013-02-08 20:05:52 +01:00
parent 0a1f41399d
commit a4724c5dac
3 changed files with 9 additions and 6 deletions

View File

@ -14,7 +14,7 @@ let s:prgpath = s:bundleDir."/js-beautify/python/".s:prgname
if executable(s:prgpath)
"If js-beautify is installed as a bundle
let &formatprg=s:prgpath." ".s:arguments
let b:formatprg=s:prgpath." ".s:arguments
else
"Else look for js-beautify globally
"or in the formatters/folder

View File

@ -14,4 +14,5 @@ call g:FindFormatter(s:prgname, s:arguments)
"Set indenting behaviour to match with the formatter
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4

View File

@ -29,11 +29,13 @@ function! g:FindFormatter(name, args)
endif
if executable(s:prgpath)
let &formatprg=s:prgpath." ".a:args
let w:formatprg=&formatprg
let t:formatprg=&formatprg
let b:formatprg=&formatprg
let b:formatprg=s:prgpath." ".a:args
endif
endfunction
"TODO: Now when buffer/window/tab changes, reload formatprg from the vars
"formatprg is a global option
"So when buffer/window/tab changes, (re)load formatprg from the bufferlocal
"variable
au BufEnter,WinEnter * let &formatprg=b:formatprg
"Default value for b:formatprg is empty string
let b:formatprg = ""