I am very likely missing something very obvious, for I am very new to the vim world.

The effect I intended to achieve was to mimic the Inline Fold extension for vscode using vim's Conceal.

In short, I've made a syntax file! and it works!

set conceallevel=2

syntax match Normal '\vclassName\=".{-}"'ms=s+11,me=e-1 conceal cchar=󰇘 

Now the crux. I have this .vim file, and I can manually source it, but I wish for it to come up when I open up a tsx file.

Now, my understanding is, you just slap it in ~/.config/nvim/after/syntax/<filetype>.vim and bobs your uncle.

So my first step was to see what filetype I was interacting with, which after running :set ft I am greeted with filetype=typescriptreact.

So neat, I put my file in ~/.config/nvim/after/syntax/typescriptreact.vim annnddd... no cigar.

I also tried ~/.config/nvim/syntax/typescriptreact.vim, again, no cigar

I notice that running :set syntax results in syntax=, and I had wondered if that is specific to typescriptreact being funny, however this is also true for when I open a Rust file.

If I have missed any crucial info please let me know! I am honestly out of ideas.

E: This is also my first SE/SO post ever, sorry if I broke any taboo

E2: https://www.github.com/zynh0722/nvim

2 Answers 2


It seems to me that syntax is not activated. I recommend you add the following statement in your ~/.config/nvim/init.vim file:

syntax enable

With this statement when Vim set the filetype it also set the syntax and search for a syntax file. It should then find your addition.

  • I tried calling syntax enable from my init.lua with vim.cmd('syntax enable') as well as switching to a vim file and just embedding my lua config into it and caling syntax enable from there. But nothing seems to have changed. Mar 10, 2023 at 13:56
  • 1
    Same thing as before, syntax=. Just as a sanity check, I get the same thing for Rust Mar 10, 2023 at 14:51
  • 1
    version 0.8.3 Release, it's the brew arm64 build Mar 10, 2023 at 15:42
  • 1
    g:syntax_on is 1. Running with --clean didn't seem to do much, either way g:syntax_on is 1 Mar 10, 2023 at 18:14
  • 1
    I've done more investigating, I may have overlooked treesitter, so I sat around trying to get a query to do what I want, just to find out I cant even get queries to load for typescriptreact, either that or I dont know how they work. Mar 11, 2023 at 5:53

syntax will not work so long as I have treesitter enabled. The correct path is to use treesitter to achieve this goal. :h treesitter-highlight-conceal

In theory disabling treesitter would allow that syntax file to load, however that doesn't solve my specific use case, as disabling TS is a none-starter.

  • It would be good if you could write what you did to solve your problem. I'm sure it will help others. Mar 28, 2023 at 5:25
  • 1
    My problem has become a ts query issue now, if I disabled treesitter the syntax file would probably load, but honestly idk, as that path isn't a direction I wish to head, unfortunately this question was never really answered in the direction I intended, so I made this answer, which explains why it doesn't work. vi.stackexchange.com/questions/41685/… Mar 28, 2023 at 10:26
  • 1
    nonetheless I've added that disabling treesitter might work, havent really checked though Mar 28, 2023 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.