I am using the Mac OS X terminal.
Most of the default color schemes I try in vim use terrible red colors for my JavaScript code.
Most of the code appears red. Does anyone know how to set the colors for JavaSript files in vi?
I am using the Mac OS X terminal.
Most of the default color schemes I try in vim use terrible red colors for my JavaScript code.
Most of the code appears red. Does anyone know how to set the colors for JavaSript files in vi?
Share Improve this question edited Dec 25, 2013 at 20:39 Eric Leschinski 154k96 gold badges422 silver badges337 bronze badges asked Mar 12, 2011 at 22:31 Shai UIShai UI 52k77 gold badges218 silver badges316 bronze badges3 Answers
Reset to default 2Whatever you do with custom syntax files and colorschemes will be useless if you don't tweak the color settings of Terminal.app and/or switch to iTerm2 or MacVim.
Most colorschemes are made for the GUI versions of vim or for vim running in a terminal that supports 256 colors.
Terminal.app only supports 16 colors and the basic colors are horrible, you can tweak them with TerminalColoreopard but you still have only a very limited palette to work with when tweaking your colorscheme.
So, that's one part of the problem.
Another one is probably that your document's filetype is set to html
which prevents you to have good JS syntax highlighting and proper omni pletion. You can change that by typing :set ft=html.javascript
.
The last part of your problem is that you use inline JavaScript.
--- EDIT ---
It's 2016, now, and Terminal.app has no problem whatsoever displaying 256 colors so there's no need for that "TerminalColoreopard" hack anymore.
--- ENDEDIT ---
I've modified 2 files to fit my javascript workflow.
Yi Zhao's Javascript syntax
: I've added AJAX, DOM keywords, methods and others.ir_black
: I called it Nazca, and it has some lines bined with with my syntax makes the js files look a lot better than the stock syntax.
Please check them out, they are not perfect but if you can fix it, add more features, please share.
UPDATE: Modification to your colorscheme is no longer required since the new version of the script hilinks all the new introduced highlights to existing keywords. Follow it in github
This question is a lot like this one: Javascript syntax highlighting in vim
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744964062a4603566.html
评论列表(0条)