neoformat icon indicating copy to clipboard operation
neoformat copied to clipboard

`latexindent` ignores `localSettings.yaml` although `-l` is specified

Open tamasgal opened this issue 7 years ago • 3 comments
trafficstars

latexindent is called with the -l options, which tells latexindent to look for a localSettings.yaml file in the same directory as the .tex file is in. As seen here: https://github.com/sbdchd/neoformat/blob/master/autoload/neoformat/formatters/tex.vim#L8

This however seems not to work with neoformat.

Here is a command line session to verify that latexindent works and uses the local configuration:

░ tamasgal@greybox:~/tmp
░ 00:30:25 > cat localSettings.yaml
defaultIndent: '  '
░ tamasgal@greybox:~/tmp
░ 00:30:34 > latexindent test.tex
\begin{abstract}
	test
\end{abstract}
░ tamasgal@greybox:~/tmp
░ 00:30:36 > latexindent -l test.tex
\begin{abstract}
  test
\end{abstract}

However, when calling :Neoformat in neovim, you get the same output as for the latexindent command without the -l option, thus ignoring the settings file.

Note that latexindent requires the localSettings.yaml to be in the same folder as the .tex file. So this issue is caused by the temp file handling as seen in the verbose output:

Neoformat: ['\begin{abstract}', 'test', '\end{abstract}']
Neoformat: latexindent -l -w /var/folders/n2/fpv312vd5xg91ncw_s5f1m5m0000gn/T/neoformat/test.tex
Neoformat: using tmp file
Neoformat: ['\begin{abstract}', '^Itest', '\end{abstract}']
Neoformat: [0]
Neoformat: 0
Neoformat: latexindent formatted buffer

tamasgal avatar Jul 16 '18 22:07 tamasgal

With this settings, it works as expected:

let g:neoformat_tex_latexindent = {
  \ 'exe': 'latexindent',
  \ 'args': ['-l'],
  \ 'stdin': 1
  \ }

tamasgal avatar Jul 16 '18 22:07 tamasgal

Is this solved? I tried using solution proposed by @tamasgal but it does not seems that it helped, my localSettings.yaml present in the same dir than the .tex files is not taken into account.

lambtho12 avatar Apr 16 '20 21:04 lambtho12

I used -l with a full path. However, neoformat turn my code into some messy code. image image

xyecoding avatar Mar 17 '22 02:03 xyecoding