File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes open the syntax color in vi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "open the syntax color in vi" Watch "open the syntax color in vi" New topic

open the syntax color in vi

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416

i install the vim6.3 in my windows xp, then i download a ksh script named "ftpshell", from the unix server, then i open it with the vim, it works well, but when i open another vim windows, and copy the script content to the new vim, i found that the syntax color losed in the new windows whether or not i save it and reopen it and use the command "syntax on", the only solution is to rename it as "",but i don't want to change the name, who can help me? i think there must be a good idea.

Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

Vim supports lexical ("syntax") highlighting for a number of different language forms and identifies each one by the file extension. Without some kind of identifier, vim can't know which highlighting rules to use.

You can either change the name of your file or you can write a rules that reads a file name with no extension as a shell script.

I think it would be easiest to edit a file renamed with a .ksh extension, then copy it back to the original name when you're done.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
I agree. Here's the link:
subject: open the syntax color in vi
jQuery in Action, 3rd edition