othree / yajs.vim

YAJS.vim: Yet Another JavaScript Syntax for Vim
http://www.vim.org/scripts/script.php?script_id=4974
Vim License
688 stars 41 forks source link

Simple way to disable builtin method/prop highlighting #60

Open simonratner opened 9 years ago

simonratner commented 9 years ago

I prefer not to highlight all the known methods and props of built-in objects. Many of them are too generic and conflict with unrelated code, creating pretty things like this:

pretty

(Not to mention that sometimes a keyword is highlighted differently based on context, as you can see with parent: in one case it is part of javascriptGlobals, in another it is a javascriptBOMWindowProp, but really it should not be highlighted at all).

I haven't found a setting to disable them. I could comment out all the /syntax/yajs/* includes, but that also removes useful things like the global functions themselves (I would like to keep Map, but not Map.get).

simonratner commented 9 years ago

Perhaps a more flexible approach is to avoid linking these highlight groups directly in the syntax files, but instead cluster them into a small number of categories that are easy to link in syntax/javascript.vim or override in .vimrc? Ideally, I would like to have:

Then specific implementation syntax files could add their own things to these (for node.js, require goes into javascriptBuiltinGlobal and require.resolve into javascriptBuiltinStatic).

Personally, I could then comment out all syntax/yajs/* includes that are not relevant to me (I'll keep es6 and node.js, for example) and also do something like this in my own environment:

hi link javascriptBuiltinGlobal Structure
hi link javascriptBuiltinStatic Identifier
hi link javascriptBuiltinProp   Normal
othree commented 9 years ago

I am going to refactor this part. But not very soon.(will be very busy until end of year).

Some info for you. https://github.com/othree/webidl-to-vim-syntax will be the base. Not sure how it will be included now.

simonratner commented 9 years ago

Awesome, for now I'll work around it.

othree commented 8 years ago

Since the performance issue on neovim. The webidl.vim will not come in as default. So this will then be implement later.

But my idea is beside your suggestion. Give an option to not include syntax/yajs/*. I think will have a little better performance.