Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 如何按如下所示设置格式?_Vim_Formatting_Text Width - Fatal编程技术网

Vim 如何按如下所示设置格式?

Vim 如何按如下所示设置格式?,vim,formatting,text-width,Vim,Formatting,Text Width,这些是.vimrc中的我的格式选项: set formatoptions=tqronw set formatlistpat=^\\([\\-\\*]\\\|[0-9]\\+[.)]\\)\\s* set textwidth=72 set autoindent 1) 我的文本: 格式化后的输出: - This is my text this is my text this is my text this is my text this is my text this is my text.

这些是.vimrc中的我的格式选项

set formatoptions=tqronw
set formatlistpat=^\\([\\-\\*]\\\|[0-9]\\+[.)]\\)\\s*
set textwidth=72
set autoindent
1)
我的文本:

格式化后的输出:

- This is my text this is my text this is my text this is my text this is my 
 text this is my text.
for Biochemistry, conducted a quality clinical study to determine the
 effects of microwave cooking on food
预期产出:

- This is my text this is my text this is my text this is my text this is my 
  text this is my text.
for Biochemistry, conducted a quality clinical study to determine the
effects of microwave cooking on food
2)
我的文本:

格式化后的输出:

- This is my text this is my text this is my text this is my text this is my 
 text this is my text.
for Biochemistry, conducted a quality clinical study to determine the
 effects of microwave cooking on food
预期产出:

- This is my text this is my text this is my text this is my text this is my 
  text this is my text.
for Biochemistry, conducted a quality clinical study to determine the
effects of microwave cooking on food
编辑
找到了我的第一个问题的解决方案:)
文本中没有(可见的)nbsp(没有空格)。

当我用普通空格替换时,格式如预期的那样

让我对你的第二个问题做一个粗略的猜测。尝试添加:

set nosmartindent

要使非中断空格与普通空格区分开来,请使用
set list lcs=tab:\\,nbsp:\
(也可以在此处使用除
tab:\\
之外的其他内容来查看选项卡)。没有一个选项会突出显示宽度不同的大量其他unicode空格,但所有选项都可能具有与非中断空格相同的效果。很高兴它起到了作用。很久以前,我记得必须深入到对我庞大的.vimrc进行二进制搜索的层次,才能找到这个。