> Hello, Guys
>
> I just notice something on my laptop.
>
> Everytime I create a text file for perl, vi/konsole does not show me
> the syntax highlight and indent until I save the file and reopen it.
>
> So I am wandering if any of you have this issue or not.
>
> I running the latest version of kde and openSUSE 64bit.
>
> Thanks,
Could it be that the file name extension is used to decide what syntax
highlighting to use?
vi can’t determine the syntax highlight to use without something to go on. Usually this is the file name but I think it can also figure it out from the #! at the top.
If you want to tell vi what syntax to use (either because it doesn’t know or its wrong) hit Esc and type the following
:set syntax=perl
replace “perl” with whatever syntax highlight you want to use e.g. python, cpp, sh (heaps more are supported).
There is a way to tell vim what file types to associate with particular highlighters in your ~/.vimrc file but I’ll leave that as an exercise for the reader.