I have been looking at the new Objective-J / Cappuccino javascript framework from 280North. They provide plug-ins for SubEthaEdit and TextMate to handle syntax highlighting, but I primarily use vi. Does anyone know of a way to get Objective-J syntax highlighting in vi, or a good way to convert whatever format the other two editors use?
Turn On or Turn Off Syntax Highlighting in VI You can Turn On or Turn Off syntax highlighting by pressing ESC button and use command as :syntax on and :syntax off in Vi editor.
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
Press 1 to highlight the current visually selected text, or the current word (if nothing is selected). Highlight group hl1 is used. Press 2 for highlight hl2 , 3 for highlight hl3 , etc. Press 0 to remove all highlights from the current visually selected text, or the current word.
vim/ (aka ~/. vim/ ), which means that Vim looks for syntax files in your home folder first before it looks anywhere else. Vim looks for your extra files by searching ~/. vim/plugin/*.
the source on github now include a vim highlight module.
I've found just doing what is suggested here is not enough:
download the file as Francisco suggests
unzip, cd Tools/
dir
run the shell, sh install-tools
copy the objj.vim file to vim dir, cp Tools/Editors/objj.vim /usr/share/vim/vim71/syntax/
Problem
I found no syntax highlighting worked for ".j" files. So the problem here is no file extension recognition. If you are using gvim as I am there is also no menu item.
Add Objective-J to gvim menu
To add a menu-item in gvim for Syntax->Ne-MO->Objective J:
sudo vim /usr/share/vim/vim71/synmenu.vim
add the following line.
an 50.70.465 &Syntax.Me-NO.Objective\ J :cal SetSyn("objj")<CR>
below the objective-C entry.save and quit
:wq!
then reload a ".j" file in gvim. If you then go:
highlighting for your selected Objective-J file should occur.
Objective-J auto-highlighting?
But what about auto-highlighting when you load the file? There appears to be no file associations. So:
sudo vim /usr/share/vim/vim7.1/filetype.vim
In the file you will find a list of filetype associations. If you want an idea where to add the line, search for "setf ocaml" in filetype.vim. Add the line below above (alphabetical):
"" Objective J au BufNewFile,BufRead *.j setf objj
Save the result. You should now be able to load a file with a ".j" extension and syntax highlighting for Objective-J files works.
Result
Now you should get automatic recognition of the Objective-J files by file type ".j" and a way to set this filetype in gvim. This probably should be added by Bram or whoever does the official release of vim but for the moment this hack works for me. (Ubuntu 8.10, Vim 7.1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With