Vim 如何按如下所示设置格式?
这些是.vimrc中的我的格式选项: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.
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进行二进制搜索的层次,才能找到这个。