如何防止 Vim 缩进括号中的换行文本
这个问题困扰了我很长时间,我尽了最大的努力,但找不到解决的办法。
当我编辑文本(特别是乳胶,但这并不重要)文件时,我希望它在 80 列时自动换行。 它会这样做,除非我碰巧位于括号子句的中间,它会缩进文本,这非常烦人。 例如,这工作正常,
Here is some text... over
two lines.
但这不行。
Here is some text... (over
two
lines
如果有人能告诉我如何关闭它(仅适用于文本/乳胶文件),我将非常感激。 大概这与 C 中期望的行为有关,但我仍然不明白出了什么问题。
This has bugged me for a long time, and try as I might I can't find a way round it.
When I'm editing text (specifically latex, but that doesn't matter) files, I want it to auto-wrap at 80 columns. It does this, except if I happen to be in the middle of a parenthetical clause, it indents the text which is very annoying. For example, this works fine
Here is some text... over
two lines.
but this doesn't
Here is some text... (over
two
lines
If anyone can tell me how to turn this off (just for text/latex files) I'd be really grateful. Presumably it has something to do with the fact that this is desired behaviour in C, but I still can't figure out what's wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
其他选项不执行任何操作,文件类型检测也不会更改它。
The other options do nothing, and the filetype detection doesn't change it.
您可能需要关闭三个选项:set noai、set nosi 和 setnocin(autoindent、smartindent 和 cindent)。
There are three options you may need to turn off: set noai, set nosi, and setnocin (autoindent, smartindent, and cindent).
这可能是相关的,当从 gui 粘贴到终端窗口时,vim 无法区分粘贴模式,因此为了阻止发生任何奇怪的事情:
然后粘贴文本
我在尝试粘贴 xml 文本时遇到了类似的问题,它只会继续缩进。 :)
gvim,vim 的 GUI 版本,可以检测粘贴模式。
This may be related, when pasting from gui into terminal window, vim cannot distinguish paste modes, so to stop any odd things from occuring:
then paste text
I had similar issues trying to paste xml text, it would just keep indenting. :)
gvim, the gui version of vim, can detect paste modes.
您可以查看自动缩进选项:
You can have a look at the autoindent option :
来自官方 Vim 文档
From the official Vim documentation
:set noai
设置不自动缩进 tt 可能是 smartindent。 查看文档,看看是否可以找到更多内容
http://www.vim.org/ htmldoc/indent.html
:set noai
sets no auto indent tt may be smartindent though. Check out the doc and see if you can find something more
http://www.vim.org/htmldoc/indent.html