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:
parent
0a1f41399d
commit
a4724c5dac
@ -14,7 +14,7 @@ let s:prgpath = s:bundleDir."/js-beautify/python/".s:prgname
|
|||||||
|
|
||||||
if executable(s:prgpath)
|
if executable(s:prgpath)
|
||||||
"If js-beautify is installed as a bundle
|
"If js-beautify is installed as a bundle
|
||||||
let &formatprg=s:prgpath." ".s:arguments
|
let b:formatprg=s:prgpath." ".s:arguments
|
||||||
else
|
else
|
||||||
"Else look for js-beautify globally
|
"Else look for js-beautify globally
|
||||||
"or in the formatters/folder
|
"or in the formatters/folder
|
||||||
|
@ -14,4 +14,5 @@ call g:FindFormatter(s:prgname, s:arguments)
|
|||||||
"Set indenting behaviour to match with the formatter
|
"Set indenting behaviour to match with the formatter
|
||||||
set expandtab
|
set expandtab
|
||||||
set tabstop=4
|
set tabstop=4
|
||||||
|
set softtabstop=4
|
||||||
set shiftwidth=4
|
set shiftwidth=4
|
||||||
|
@ -29,11 +29,13 @@ function! g:FindFormatter(name, args)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if executable(s:prgpath)
|
if executable(s:prgpath)
|
||||||
let &formatprg=s:prgpath." ".a:args
|
let b:formatprg=s:prgpath." ".a:args
|
||||||
let w:formatprg=&formatprg
|
|
||||||
let t:formatprg=&formatprg
|
|
||||||
let b:formatprg=&formatprg
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
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 = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user