Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autoload/ale/fix/registry.vim
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with rumdl.',
\ },
\ 'tex-fmt': {
\ 'function': 'ale#fixers#tex_fmt#Fix',
\ 'suggested_filetypes': ['bib', 'tex'],
\ 'description': 'Fix LaTeX and bibliography files with tex-fmt.',
\ }
\}

" Reset the function registry to the default entries.
Expand Down
20 changes: 20 additions & 0 deletions autoload/ale/fixers/tex_fmt.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
" Author: https://github.com/Spixmaster
" Description: Fix LaTeX and bibliography files with tex-fmt.

call ale#Set('tex_tex_fmt_executable', 'tex-fmt')
call ale#Set('tex_tex_fmt_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('tex_tex_fmt_options', '')

function! ale#fixers#tex_fmt#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'tex_tex_fmt',
\ ['tex-fmt']
\)

let l:options = ale#Var(a:buffer, 'tex_tex_fmt_options')

return {
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -s',
\}
endfunction
1 change: 1 addition & 0 deletions doc/ale-supported-languages-and-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ Notes:
* `lacheck`
* `proselint`
* `redpen`
* `tex-fmt`
* `texlab`
* `textlint`
* `vale`
Expand Down
24 changes: 24 additions & 0 deletions doc/ale-tex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@ g:ale_tex_latexindent_options
This variable can be changed to modify flags given to latexindent.


===============================================================================
tex-fmt *ale-tex-tex-fmt*

*ale-options.tex_tex_fmt_executable*
*g:ale_tex_tex_fmt_executable*
*b:ale_tex_tex_fmt_executable*
tex_tex_fmt_executable
g:ale_tex_tex_fmt_executable
Type: |String|
Default: `'tex-fmt'`

See |ale-integrations-local-executables|.

*ale-options.tex_tex_fmt_options*
*g:ale_tex_tex_fmt_options*
*b:ale_tex_tex_fmt_options*
tex_tex_fmt_options
g:ale_tex_tex_fmt_options
Type: |String|
Default: `''`

This variable can be changed to modify flags given to tex-fmt.


===============================================================================
texlab *ale-tex-texlab*

Expand Down
1 change: 1 addition & 0 deletions doc/ale.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4008,6 +4008,7 @@ documented in additional help files.
cspell................................|ale-tex-cspell|
lacheck...............................|ale-tex-lacheck|
latexindent...........................|ale-tex-latexindent|
tex-fmt...............................|ale-tex-tex-fmt|
texlab................................|ale-tex-texlab|
redpen................................|ale-tex-redpen|
texinfo.................................|ale-texinfo-options|
Expand Down
1 change: 1 addition & 0 deletions supported-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ formatting.
* [lacheck](https://www.ctan.org/pkg/lacheck)
* [proselint](http://proselint.com/)
* [redpen](http://redpen.cc/)
* [tex-fmt](https://github.com/WGUNDERWOOD/tex-fmt)
* [texlab](https://texlab.netlify.com) :speech_balloon:
* [textlint](https://textlint.github.io/)
* [vale](https://github.com/ValeLint/vale)
Expand Down
12 changes: 12 additions & 0 deletions test/fixers/test_tex_fmt_fixer_callback.vader
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Before:
call ale#assert#SetUpFixerTest('tex', 'tex-fmt')

After:
Restore

call ale#assert#TearDownFixerTest()

Execute(The tex-fmt callback should return the correct default command):
AssertEqual
\ {'command': ale#Escape('tex-fmt') . ' -s'},
\ ale#fixers#tex_fmt#Fix(bufnr(''))
Loading