Compare commits

..

1 Commits

Author SHA1 Message Date
fa204e07a0 Move formatexpr config in-tree, out of plugin
Introduces the `format` Python module which provides `clang_format()`
and `yapf()` functions which efficiently (compared to vimscript) invoke
`clang-format` or `yapf` respectively then apply the minimal number of
changes using `difflib.SequenceMatcher`.

Additionally, in order to invoke these Python functions add |autoload|
functions `format#clang_format()` and `format#yapf()` which can be
directly used by the 'formatexpr' setting.

Finally, add |ftplugin| files which set 'formatexpr' when the |autoload|
functions are available.
2021-03-24 23:37:19 +00:00
9 changed files with 8 additions and 9 deletions

View File

@ -2,7 +2,6 @@ if !has('pythonx')
finish
endif
" set debug=msg,throw
pythonx import format
function! format#clang_format() abort

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@ -1,3 +1,3 @@
if has('pythonx')
if exists('*format#yapf')
set formatexpr=format#yapf()
endif