I'm using AstroNvim to edit a .tex
file. When I use gw
to wrap some text, it introduces an indentation on every line after the first of the paragraph, as shown below:
I don't understand why this happens. If I create a minimal .tex
file with just the few necessary commands to create a document, and one section, and put in the same text, it wraps just fine, with no indentations. This makes me think it might be some sort of context in the larger file I'm working with, which has a bunch of stuff from a journal template. I can't figure out what it is, though.
I've tried a few things such as :set breakindent
or :set nobreakindent
, but with the same result. (As you can probably tell, I'm far from an expert at vim settings.)
More details on version:
> nvim -V1 -v
NVIM v0.10.3, Build type: Release, LuaJIT 2.1.1734355927
I'm using AstroNvim to edit a .tex
file. When I use gw
to wrap some text, it introduces an indentation on every line after the first of the paragraph, as shown below:
I don't understand why this happens. If I create a minimal .tex
file with just the few necessary commands to create a document, and one section, and put in the same text, it wraps just fine, with no indentations. This makes me think it might be some sort of context in the larger file I'm working with, which has a bunch of stuff from a journal template. I can't figure out what it is, though.
I've tried a few things such as :set breakindent
or :set nobreakindent
, but with the same result. (As you can probably tell, I'm far from an expert at vim settings.)
More details on version:
> nvim -V1 -v
NVIM v0.10.3, Build type: Release, LuaJIT 2.1.1734355927
Share
Improve this question
edited Feb 11 at 1:50
Kyle F. Hartzenberg
3,7203 gold badges14 silver badges40 bronze badges
asked Feb 10 at 9:33
TorTor
7858 silver badges22 bronze badges
3
|
1 Answer
Reset to default 1It seems like your configuration sets breakindentopt
to "shift:4"
whenever the file type is set to tex
as opposed to plaintex
.
The solution should be to add the following to your configuration (ensuring that it is not overwritten later, for example, when certain file types are detected):
vim.opt.breakindentopt = ""
See h: breakindentopt
for more information on the options for how wrapped text should be broken and indented.
Additional Note
You might also like/need to set the default file type for .tex
files from plain TeX to LaTeX if you don't work with plain TeX files. Do this by adding the following to your configuration:
vim.g.tex_flavor = "latex"
This helps avoid file type misdetection issues.
See h: filetype-overrule
for more information on default file types.
:set ft?
on the working/non-working files. See:help ft-tex-plugin
for how different flavors of TeX are detected. Rule out that's not the cause of the problem. – Friedrich Commented Feb 10 at 9:50filetype=plaintex
, the other saysfiletype=tex
. – Tor Commented Feb 10 at 9:57