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

Conceal on NeoVim not working #2388

Closed
ignamartinoli opened this issue May 9, 2022 · 8 comments
Closed

Conceal on NeoVim not working #2388

ignamartinoli opened this issue May 9, 2022 · 8 comments
Labels

Comments

@ignamartinoli
Copy link

Description

I tried to set the concealment as shown in this guide with the following entries in the package configuration file ~/.config/nvim/lua/plugins/vimtex.lua:

local g = require 'utils'.g

g.tex_conceal = 'abdmg'
g.vimtex_view_method = 'zathura'
g.vimtex_toc_config = {
	name = 'ToC',
	layers = { 'content', 'todo', 'include' },
	show_help = false
}

After that I created a LaTeX file to try it out but unsuccessfully.

Steps to reproduce

  1. Open a LaTeX file with Neovim
  2. Type:
\documentclass{article}

\usepackage{amsmath}

\begin{document}
	\section{A}
		\begin{align}
			\in \cdot
		\end{align}
\end{document}

Expected behavior

Seeing the concealment

Actual behavior

The concealment isn't working

Do you use a latexmkrc file?

Yes

VimtexInfo

System info:
  OS: Gentoo Base System release 2.8
  Vim version: NVIM v0.8.0-dev+11-gd3121f1e6-dirty
  Has clientserver: true
  Servername: /tmp/nvimnv2zo3/0

VimTeX project: doe
  base: doe.tex
  root: /home/sicro/Code/LaTeX
  tex: /home/sicro/Code/LaTeX/doe.tex
  main parser: current file verified
  document class: article
  packages: amsmath
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    build_dir: output
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  qf method: LaTeX logfile
@nullchilly
Copy link

nullchilly commented May 9, 2022

Conceal doesn't work with treesitter, disable it :TSBufDisable highlight

Related "issue": #1968

@lervag
Copy link
Owner

lervag commented May 9, 2022

Thanks, @nullchilly, I believe you are quite right.

I'm curious if there is any way for me to detect this from VimTeX so that we can warn the user?

By the way, @ignamartinoli: there is no reason to set g.tex_conceal for VimTeX. Also, notice that you do need set conceallevel=1 or set conceallevel=2. You should read :help conceallevel and :help concealcursor.

@ignamartinoli
Copy link
Author

@lervag Hi, I forgot to mention that I have conceallevel setted on my ~/.config/nvim/after/ftplugin/tex.lua:

local g   = require 'utils'.g
local map = require 'utils'.map
local opt = require 'utils'.opt
local loc = require 'utils'.loc

opt.shiftwidth = 2
opt.softtabstop = 2
opt.tabstop = 2

g.tex_conceal = 'abdmgs'
loc.conceallevel = 1

loc.spell = true
opt.spelllang = 'en,es'

map('i', '<C-s>', [[<C-g>u<Esc>[s1z=`]a<c-g>u]])

When I deactivated TreeSitter the concealment actually worked so I guess that was the issue. Still it would be cool to see TreeSitter support in the future. Thanks everyone for the help

lervag added a commit that referenced this issue May 9, 2022
@lervag
Copy link
Owner

lervag commented May 9, 2022

I've pushed an update that

  1. warns people who are using Tree-sitter for highlighting (unless they disable VimTeX's syntax highlighting), and
  2. improves documentation of VimTeX vs Tree-sitter (see :help vimtex-faq-treesitter).

@lervag
Copy link
Owner

lervag commented May 9, 2022

@ignamartinoli Nice to know your problem is settled! Notice, again, that you don't need g:tex_conceal. You can control the VimTeX conceal settings with :help g:vimtex_syntax_conceal.

Still it would be cool to see TreeSitter support in the future.

I'm sorry to say that I will most likely never go there. I'm satisfised with the current implementation and see no specific need to rewrite everything in Tree-sitter. But perhaps someone will do it someday; that is not unlikely. And I will be glad to update VimTeX (both code and docs) to better integrate with Tree-sitter if/when the highlighter is good enough!

@lervag
Copy link
Owner

lervag commented May 9, 2022

For the general community: Feel free to read the new :help vimtex-faq-treesitter and let me know if you think I'm being imprecise or if you have suggestions for improving the text. (e.g. @clason @krishnakumarg1984)

@krishnakumarg1984
Copy link
Contributor

I did read it. Sounds good to me

@lervag
Copy link
Owner

lervag commented May 10, 2022

Thanks!

YodaEmbedding added a commit to YodaEmbedding/dotfiles that referenced this issue Oct 19, 2023
As mentioned here:
lervag/vimtex#2388 (comment)
...be sure to disable highlight via `:TSBufDisable highlight`.
Maybe make this an autocmd?
(Not sure if Treesitter configuration allows us to disable this selectively.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants