Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Changing tag color and matching tag highlight #101

Closed
stvkim opened this issue Nov 9, 2019 · 8 comments
Closed

[Question] Changing tag color and matching tag highlight #101

stvkim opened this issue Nov 9, 2019 · 8 comments

Comments

@stvkim
Copy link

stvkim commented Nov 9, 2019

Hi. thank you for this great plugin
with the vim-jsx-pretty default setting, the tag < and > appears to have the same color as comment syntax, as we can see No.1 and No.2 on the image below.

so I was wondering

  1. if there is any way to change the color like No.3 (gray color)
  2. if you know any vim plugin that can implement a matching tag highlight function on jsx file like the effect No.4

2019-11-09_15-41

I know that I should be able to handle this kind of small issues but I'm kind of a newbie in this area. It would be really helpful if you could give me some advice on how to handle those issues.
Thank you in advance!

@yuezk
Copy link
Collaborator

yuezk commented Nov 9, 2019

  1. Yes, you can link the jsxCloseString syntax group to the target highlight group.

    highlight def link jsxCloseString <target highlight group>
  2. This a good feature. And I think it can be implemented with the searchpair() API.

May I know which colorscheme and plugin do you use to highlight the right one?

@yuezk yuezk added the question label Nov 9, 2019
@stvkim
Copy link
Author

stvkim commented Nov 10, 2019

Thanks. I will try that out! The first one would be easy to implement. Do you think if there will be any chance you guys could add the pair highlighting feature in the future update?

I use 'codedark' colorscheme -> tomasiser/vim-code-dark
and the plugin I used for the right one is 'matchtagalways' -> Valloric/MatchTagAlways

@yuezk
Copy link
Collaborator

yuezk commented Nov 10, 2019

I will try to integrate with the MatchTagAlways plugin first, I will try to implement this feature if it doesn't work.

@yuezk
Copy link
Collaborator

yuezk commented Nov 10, 2019

@Heejoong For the second question, please add the following config in your vimrc.

let g:mta_filetypes = {
    \ 'html' : 1,
    \ 'xhtml' : 1,
    \ 'xml' : 1,
    \ 'jinja' : 1,
    \ 'javascript': 1, " <-- or 'javascript.jsx': 1
    \}

Please pay attention to the performance of moving cursor.

Reference: Valloric/MatchTagAlways#30

@yuezk yuezk added the support label Nov 10, 2019
@yuezk
Copy link
Collaborator

yuezk commented Nov 10, 2019

And for the first question, please try to add hi link jsxCloseString htmlTag into your vimrc.

image

@stvkim
Copy link
Author

stvkim commented Nov 10, 2019

Thank you so much yuezk! That's very kind of you.
Everything working perfectly as I wanted.
I don't know how I missed adding javascript on mta_filetypes. I tried just 'js' and 'jsx' and thought maybe it's not working for the javascript file. shame on me.
Thanks and happy coding! :-)

@stvkim stvkim closed this as completed Nov 10, 2019
@yuezk
Copy link
Collaborator

yuezk commented Nov 10, 2019

@Heejoong Because you need to add filetypes, js and jsx are extensions, not filetypes.

@dagolinuxoid
Copy link

Btw I used javascriptreact (got from :set ft? command) filetype in my .vimrc config and it seems like it works properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants