1

I've set conceallevel=0 in .vimrc, but the text is not shown normally after opening .tex file. I have to type it again while the file is open and it works.

From my .vimrc:

"vimtex config
set conceallevel=0
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:tex_conceal = ''
let g:vimtex_fold_manual = 1

4
  • 4
    See :h 'conceallevel': local to window this means that setting it in your vimrc has no effect you need to set it either in a ftplugin or in an autocommand. I'm not posting an answer because I'm sure we have several duplicate about the same kind of issues.
    – statox
    Apr 30, 2021 at 14:43
  • You might want to check out How to debug my vimrc; in general, we do not need your whole vimrc in the post. A smaller example is better.
    – D. Ben Knoble
    May 2, 2021 at 20:26
  • Sure, I edited it. Now it includes only these lines that are related to the problem.
    – bronekb
    May 2, 2021 at 22:44
  • You should mention explicitly that you use VimTeX. Note that, from VimTeX v2.0, the g:tex_conceal and g:tex_flavor are no longer relevant and will most likely do nothing. May 4, 2021 at 19:32

1 Answer 1

2

@statox, thank you! I've set two autocommands:

autocmd BufEnter *.tex set conceallevel=1
autocmd BufEnter *.tex set concealcursor=n

I've found this concealcursor feature, it seems useful to remove concealment of one line only when editing it. So I don't need set conceallevel=0.

I also removed let g:tex_conceal = '', looks like it doesn't work. Info from the new release of vimtex:

Vimtex no longer respects the "internal" options such as g:tex_fast and g:tex_conceal. For conceals, see :help g:vimtex_syntax_conceal.

Thanks again for not showing me the correct response, it forced me to search and learn more.

2
  • 1
    Did you check out :help g:vimtex_syntax_conceal? It looks to me that a simple let g:vimtex_syntax_conceal_default = 0 would work to disable conceal on TeX files with the new vimtex. Maybe try that? And it looks like the new option gives you a very granular control of what to display and what to conceal, in case you're interested in using some of the concealing syntax but not all...
    – filbranden
    May 2, 2021 at 3:41
  • 1
    yes, setting let g:vimtex_syntax_conceal_default = 0 in vimrc solves the original problem; looks like it's a simpler solution. But now I prefer to keep only autocmd BufEnter *.tex set concealcursor=c. It removes concealment in the places where the cursor appears. It's very comfortable for me. I guess that setting g:vimtex_syntax_conceal_default in vimrc is not necessarily needed now because its default value works fine with the functionality of concealcursor. Anyways, many thanks!
    – bronekb
    May 2, 2021 at 14:04

Your Answer

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

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