Add bufferlocal variants for all options.
This commit is contained in:
parent
5b22a44982
commit
81f5e989c2
@ -80,6 +80,8 @@ let g:autoformat_retab = 0
|
|||||||
let g:autoformat_remove_trailing_spaces = 0
|
let g:autoformat_remove_trailing_spaces = 0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To disable or re-enable these option for specific buffers, use the buffer local variants:
|
||||||
|
`b:autoformat_autoindent`, `b:autoformat_retab` and `b:autoformat_remove_trailing_spaces`.
|
||||||
You can manually autoindent, retab or remove trailing whitespace with the following respective
|
You can manually autoindent, retab or remove trailing whitespace with the following respective
|
||||||
commands.
|
commands.
|
||||||
|
|
||||||
@ -95,6 +97,7 @@ tries all formatters in this list of applicable formatters, until one succeeds.
|
|||||||
You can set this list manually in your vimrc (see section *How can I change the behaviour of formatters, or add one myself?*,
|
You can set this list manually in your vimrc (see section *How can I change the behaviour of formatters, or add one myself?*,
|
||||||
or change the formatter with the highest priority by the commands `:NextFormatter` and `:PreviousFormatter`.
|
or change the formatter with the highest priority by the commands `:NextFormatter` and `:PreviousFormatter`.
|
||||||
To print the currently selected formatter use `:CurrentFormatter`.
|
To print the currently selected formatter use `:CurrentFormatter`.
|
||||||
|
These latter commands are mostly useful for debugging purposes.
|
||||||
If you have a composite filetype with dots (like `django.python` or `php.wordpress`),
|
If you have a composite filetype with dots (like `django.python` or `php.wordpress`),
|
||||||
vim-autoformat first tries to detect and use formatters for the exact original filetype, and
|
vim-autoformat first tries to detect and use formatters for the exact original filetype, and
|
||||||
then tries the same for all supertypes occuring from left to right in the original filetype
|
then tries the same for all supertypes occuring from left to right in the original filetype
|
||||||
|
@ -138,26 +138,28 @@ function! s:Fallback()
|
|||||||
" Detect verbosity
|
" Detect verbosity
|
||||||
let verbose = &verbose || g:autoformat_verbosemode == 1
|
let verbose = &verbose || g:autoformat_verbosemode == 1
|
||||||
|
|
||||||
if g:autoformat_remove_trailing_spaces == 1
|
if exists('b:autoformat_remove_trailing_spaces') ? b:autoformat_remove_trailing_spaces == 1 : g:autoformat_remove_trailing_spaces == 1
|
||||||
if verbose
|
if verbose
|
||||||
echomsg "Removing trailing whitespace..."
|
echomsg "Removing trailing whitespace..."
|
||||||
endif
|
endif
|
||||||
call s:RemoveTrailingSpaces()
|
call s:RemoveTrailingSpaces()
|
||||||
endif
|
endif
|
||||||
if g:autoformat_retab == 1
|
|
||||||
|
if exists('b:autoformat_retab') ? b:autoformat_retab == 1 : g:autoformat_retab == 1
|
||||||
if verbose
|
if verbose
|
||||||
echomsg "Retabbing..."
|
echomsg "Retabbing..."
|
||||||
endif
|
endif
|
||||||
retab
|
retab
|
||||||
endif
|
endif
|
||||||
if g:autoformat_autoindent == 1
|
|
||||||
|
if exists('b:autoformat_autoindent') ? b:autoformat_autoindent == 1 : g:autoformat_autoindent == 1
|
||||||
if verbose
|
if verbose
|
||||||
echomsg "Autoindenting..."
|
echomsg "Autoindenting..."
|
||||||
endif
|
endif
|
||||||
" Autoindent code
|
" Autoindent code
|
||||||
exe "normal gg=G"
|
exe "normal gg=G"
|
||||||
endif
|
endif
|
||||||
return 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user