Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9056515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:13:34+00:00 2026-06-16T14:13:34+00:00

I’m writting a syntax file for Direct3D and I have a problem with the

  • 0

I’m writting a syntax file for Direct3D and I have a problem with the attributes:

[unroll]
for(int i = 0...)

Here, “unroll” is an attribute. I’m using a regex to find some keywords inside square brackets to identify them as attributes. The regex I’m using works, except when there are no spaces before the opening square bracket:

[unroll] // does not work
 [unroll] // works

It doesn’t matter the number of whitespaces (or tabs) before the opening square bracket as far as there is at least one.

This is the regex (simplified to match only unroll) I’m using:

syn match hlslAttribute /^\s*\[unroll\]/

The same problems if using:

syn match hlslAttribute /.*\[unroll\]/

EDIT:
As stated in a comment: It works while searching on the file, but not when matching the pattern for syntax highlighting.

The current syntax highlighting file can be found at: http://pastebin.com/zr1bGLt0

To enable the syntax hilighting for .fx or .hlsl files you must copy the hlsl.vim file (the one at pastebin) to the location of the syntax files in any Vim installation (/syntax: /usr/share/vim/vim73/syntax/) and add this line to your .vimrc:

autocmd BufNewFile,BufRead *.fx,*.fxc,*.fxh,*.hlsl set ft=hlsl

Then create a file with one of the previous extensions and write:

[unroll]
 [unroll]

The second line will be all the same color, while the first won’t. Both of them should be like the second one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:13:35+00:00Added an answer on June 16, 2026 at 2:13 pm

    As you’ve figured out in the comments, often the cause is interference of another syntax group (in your case, by a different plugin, Rainbow Parenthesis). If this is part of the same syntax, you can often fix things by changing the nesting hierarchy, but with an external plugin, you’re probably out of luck.

    The problem is that Vim only provides two mechanisms for highlightings, :syntax (which is bound to the buffer) and :match / matchadd(), which is bound to the window. So if you want custom highlightings for a buffer, you have to either use :syntax and risk interference with the filetype’s syntax, or use matchadd() and have to use complex autocmds to make them apply only to the current buffer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have been unable to fix a problem with Java Unicode and encoding. The
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.