minor changes
This commit is contained in:
parent
4b0a5e927a
commit
1b08973e28
@ -4,8 +4,7 @@ endif
|
|||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
"Besides installing the js-beautify globally or in the
|
"Besides installing the js-beautify globally or in the
|
||||||
"formatters/ folder, cloning the repository as a vim bundle
|
"formatters/ folder, installing as a vim bundle is supported.
|
||||||
"is supported as well.
|
|
||||||
let s:prgname = "js-beautify"
|
let s:prgname = "js-beautify"
|
||||||
let s:arguments = "-i"
|
let s:arguments = "-i"
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ if executable(s:prgpath)
|
|||||||
let b: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
|
||||||
call g:FindFormatter(s:prgname,s:arguments)
|
call g:FindFormatter(s:prgname,s:arguments)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ function! s:Autoformat()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"Create a command for this
|
"Create a command for formatting the entire buffer
|
||||||
command! Autoformat call s:Autoformat()
|
command! Autoformat call s:Autoformat()
|
||||||
|
|
||||||
"Function for finding and setting the formatter
|
"Function for finding and setting the formatter
|
||||||
@ -37,8 +37,3 @@ endfunction
|
|||||||
"So when buffer/window/tab changes,
|
"So when buffer/window/tab changes,
|
||||||
"(re)load formatprg from the bufferlocal variable
|
"(re)load formatprg from the bufferlocal variable
|
||||||
au BufEnter,WinEnter * if exists("b:formatprg") | let &formatprg=b:formatprg
|
au BufEnter,WinEnter * if exists("b:formatprg") | let &formatprg=b:formatprg
|
||||||
|
|
||||||
let b:autoformat = 1
|
|
||||||
if b:autoformat==1
|
|
||||||
inoremap <CR> <Esc>Vgqo
|
|
||||||
endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user