bugfix in formatters/ detection
This commit is contained in:
parent
fcc0f5437e
commit
e3e6694087
@ -62,7 +62,7 @@ For Ubuntu type `sudo apt-get install tidy` in a terminal.
|
||||
|
||||
How can I change the behaviour of formatters?
|
||||
---------------------------------------------
|
||||
The formatprg for a <filetype> is defined in `g:formatprg_<filetype>`.
|
||||
The formatprg for a `<filetype>` is defined in `g:formatprg_<filetype>`.
|
||||
The arguments passed to the formatprogram are defined in `g:formatprg_args_<filetype>`.
|
||||
So, a complete definition could look like this:
|
||||
|
||||
|
@ -5,11 +5,11 @@ function! s:Autoformat()
|
||||
"Save window state
|
||||
let winview=winsaveview()
|
||||
"Autoformat code
|
||||
:silent exe "normal gggqG"
|
||||
silent exe "normal gggqG"
|
||||
"Recall window state
|
||||
call winrestview(winview)
|
||||
else
|
||||
echo "No formatter set for filetype ".&filetype
|
||||
echo "No formatter defined for filetype ".&filetype
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -19,6 +19,7 @@ command! Autoformat call s:Autoformat()
|
||||
"Function for finding and setting the formatter
|
||||
"with the given name, if the formatter is installed
|
||||
"globally or in the formatters folder
|
||||
let s:formatterdir = fnamemodify(expand("<sfile>"), ":p:h:h")."/formatters/"
|
||||
function! s:set_formatprg()
|
||||
"Reset previous formatprg
|
||||
set formatprg=""
|
||||
@ -35,7 +36,6 @@ function! s:set_formatprg()
|
||||
|
||||
"Set correct formatprg path, if it is installed
|
||||
if !executable(s:formatprg)
|
||||
let s:formatterdir = fnamemodify(expand("<sfile>"), ":h:h")."/formatters/"
|
||||
let s:formatprg = s:formatterdir.s:formatprg
|
||||
if !executable(s:formatprg)
|
||||
"Configured formatprg not installed
|
||||
|
Loading…
Reference in New Issue
Block a user