aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMatheus Gabriel Werny2026-05-15 00:00:05 +0200
committerGitHub2026-05-14 23:00:05 +0100
commit916c8764ce9d395f788eae9adf207a4bfe8a038e (patch)
tree9fb4c63a5a6ff04f9812b3c0066463ca728a020e
parent641294465e20750b64b6984433fc2e5229c68044 (diff)
downloadale-916c8764ce9d395f788eae9adf207a4bfe8a038e.tar.gz

Support for tex-fmt (#5127)

  • Support for tex-fmt

Support for tex-fmt, https://github.com/WGUNDERWOOD/tex-fmt.

  • Remove file type plaintex

Remove file type plaintex as tex-fmt is solely for LaTeX. See https://superuser.com/questions/208177/vim-and-tex-filetypes-plaintex-vs-tex for a distinction.

-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/tex_fmt.vim20
-rw-r--r--doc/ale-supported-languages-and-tools.txt1
-rw-r--r--doc/ale-tex.txt24
-rw-r--r--doc/ale.txt1
-rw-r--r--supported-tools.md1
-rw-r--r--test/fixers/test_tex_fmt_fixer_callback.vader12
7 files changed, 64 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index c40f802b3..9fb97345d 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -777,6 +777,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.
diff --git a/autoload/ale/fixers/tex_fmt.vim b/autoload/ale/fixers/tex_fmt.vim
new file mode 100644
index 000000000..34f51f3f2
--- /dev/null
+++ b/autoload/ale/fixers/tex_fmt.vim
@@ -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
diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt
index 97cec8144..b53c5c915 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -373,6 +373,7 @@ Notes:
* `lacheck`
* `proselint`
* `redpen`
+ * `tex-fmt`
* `texlab`
* `textlint`
* `vale`
diff --git a/doc/ale-tex.txt b/doc/ale-tex.txt
index fde97b8e4..ca0a0e26f 100644
--- a/doc/ale-tex.txt
+++ b/doc/ale-tex.txt
@@ -71,6 +71,30 @@ g:ale_tex_latexindent_options
===============================================================================
+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*
*ale-options.tex_texlab_executable*
diff --git a/doc/ale.txt b/doc/ale.txt
index 361dc75e0..0c20eaf19 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -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|
diff --git a/supported-tools.md b/supported-tools.md
index 7a077ff87..fad93f2ff 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -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)
diff --git a/test/fixers/test_tex_fmt_fixer_callback.vader b/test/fixers/test_tex_fmt_fixer_callback.vader
new file mode 100644
index 000000000..4bea7df20
--- /dev/null
+++ b/test/fixers/test_tex_fmt_fixer_callback.vader
@@ -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(''))