I was writing a custom gvim syntax file and the number of keywords are huge (about 1000) so is there any easy way of handling that in .vim syntax files...
may be like adding all the keywords in one file and ask vim to treat everything in that file as keywords,
I have a mytype.vim file with different set of rules and i am not sure its a good idea to add those 1000 keywords in there.
any other solution or suggestions are also welcome :)
You can pass a list of keywords to the
:syntax keyword
command. Excerpt from$VIMRUNTIME/syntax/vim.vim
:So, the overhead is small, and I would recommend just that.
Of course, you can use Vim metaprogramming, i.e. read the keywords from a file (
via readfile()
) / List and dynamically build the:syntax keyword
commands, but only do this if you have a real need (e.g. when the keywords differ by language version):The parsing overhead for keywords is less than for matches or regions, so (a few) thousand keywords should be handled just fine by Vim.