After you set syntax highlighting for VIM and sometimes invalid

I am learning c programming language did not use the old-fashioned tc2.0, nor with the new tc,Before school is under linux,Learn to give up after a short time。

Now before you start,It lion in,Using the console + vi (vim) + gcc compiler。

About vi highlighting syntax and set the first line indent, etc.,Well, IPrevious articleAlso introduced a solution,With them was quite pleasant。

But the course of a few days,Still can not say there is some unexpected surprises。It is to create a document using vi writing code sometimes fail to highlight the code。it's wired,Naming has been set,But it is useless,Double check the configuration file was invalid。

Save and close the open again but can use,Later, self-study comparison,Finally found a reason for me - I really 2 ah!

The reason is that lion ancestry unix,And certain features of linux is the same,Because they are the ancestors unix,For example, the file suffix problem!

Many times on linux is no suffix,你写个c语言代码不加人和后缀甚至胡乱加个后缀gcc都能给你编译⋯⋯但是vi它不认识啊,It will rely on the document suffix guess what language you write code,才能高亮⋯⋯

so,Without suffix,vi decisive not highlight,Right when the document processing thump。Then save,Then open,It may be based on the content analysis,C language code is found,所以就又高亮了⋯⋯汗死。

we programs

Such open an empty document,vi decisively not highlight

vi program.c

Such open,Oh, only

= = I do not know if I made the same novices and 2

Haha

Original article written by Gerber drop-off:R0uter's Blog » After you set syntax highlighting for VIM and sometimes invalid

Reproduced Please keep the source and description link:https://www.logcg.com/archives/91.html

By R0uter's Blog

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a comment

Your email address will not be published. Required fields are marked *