突出显示VIM中的特定列

突出显示VIM中的特定列

本文介绍了突出显示VIM中的特定列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常处理包含固定位置数据的文件.如果您愿意,可以使用不定界的"CSV"文件.通常,我想突出显示特定的列.

I work a lot with files which contain data on fixed positions. Non-delimited "CSV" files if you will... Often, I'd like to highlight a specific column.

我尝试过

:match ErrorMsg /\%>30v.\+\%<40v/

,但是运行速度非常慢,并且仅与第一行匹配.我想这个文件可能太大了.请注意,文件非常宽(大约40000个字符),但又不太长(大约2000行).数据来自我无法控制的旧工具.

but this runs extremely slow and only matches the first line. I suppose the file may be too large for this. Mind you, the files are very wide (around 40000 characters) but not very long (around 2000 lines). The data originates from old tools over which I have no control.

示例文件:

                                                 63082
                                                 01089
                                                 75518                              735301

                                                 53473                              017146
                                                                                     37217
                                                                                        07
                                                                                    940376
                                                   762                                2842

                                                                                     88331
                                                 40680                                8928
            645718
                                                  0131
                                                                                     03522

             47210                                                                   27431

             93837
                                                                                   8825072    49479415

                                                 52084                                8940
                                               0591705                              205635
                                                                                    525429
                                                 65339                                 300


                                                  0397
                                                                                      1983
                                                     0
                                                                                   2605768
            121991                                                                     648
                                                  3892

                                                  1260

有什么想法吗?

推荐答案

您是否正在使用Vim 7.3?

Are you using Vim 7.3?

显然,他们最近才添加了colorcolumn选项.

Apparently they just recently added a colorcolumn option.

尝试:

:set colorcolumn=31,32,33,34,35,36,37,38,39

请注意,:help 'colorcolumn'表示将使屏幕重绘速度变慢".不过,我通过使用1234567890的纯块以及您指定的确切重复次数来复制了您的情况.

Note that :help 'colorcolumn' says "Will make screen redrawing slower". I somewhat replicated your scenario, though, by using pure blocks of 1234567890 with the exact repetition count you specified.

您提到的命令 非常慢. colorcolumn不是.

The command you mentioned is very slow. colorcolumn isn't.

第一行"是指启用自动换行时显示的第一行吗?不幸的是colorcolumn将表现出相同的行为...

By "first line" do you mean the first displayed line, when word wrapping is enabled? Unfortunately colorcolumn will exhibit the same behavior...

这篇关于突出显示VIM中的特定列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 11:51