最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

editor - Shifted indentation when wrapping text in TeX file with AstroNvim - Stack Overflow

programmeradmin1浏览0评论

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
  • Use "astro nvim"'s issue tracker. – romainl Commented Feb 10 at 9:40
  • 1 Compare :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:50
  • The minimal one says filetype=plaintex, the other says filetype=tex. – Tor Commented Feb 10 at 9:57
Add a comment  | 

1 Answer 1

Reset to default 1

It 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.

发布评论

评论列表(0)

  1. 暂无评论