Skip to content

Need some help with custom syntax conceal commands #3010

@Felipe-9

Description

@Felipe-9

Related to #2964

Right delimiter `\right)` missing after conceal

this code:

= \left(
...
+ c_1\,(
  e^{-x^2}
  \,(-2\,x)
)
\right)

is being concealed into

= (
...
+ c_1 (
  e^{-x^2}
   (-2 x)
)
starred commands returning error

defining \myrange{} like this

      {
        mathmode= true,
        name = "myrange*",
        nargs = 2,
        cchar_open = "]",
        cchar_close = "["
      }

results in error: Vim(syntax):E5248: Invalid character in group name

im having trouble concealing `\,` into ` ` (double spaces)
{
  mathmode=true,
  name = ",",
  concealchar = "  "
},

i get the error Vim(syntax):E5248: Invalid character in group name

closing char incorrect

this

      {
        mathmode = true,
        nargs= 1,
        name = "myVert",
        cchar_open = "",
        cchar_close = ""
      },

results in this
\myVert{...} -> ‖ ...|

also another problem with this (which is not exclusive to it, my others customs have the same problem) the spacing is wrong its only added to the first delimiter, instead of both. eg: \myvert{x^2} -> | x^2| instead of | x^2 |

Do you use a latexmkrc file?

no

vimtex.lua

return {
  "lervag/vimtex",
  lazy = false,
  init = function()
    vim.g.vimtex_view_method = "zathura"
    vim.g.latex_view_general_viewer = "zathura"
    -- vim.g.vimtex_view_method = "zathura_simple"
    vim.g.vimtex_compiler_latexmk_engines = { ["_"] = "-lualatex" }
    vim.g.vimtex_compiler_latexmk = {
      aux_dir = ".build",
      -- out_dir = "",
      options = {
        "-shell-escape",
        "-verbose",
        "-file-line-error",
        "-synctex=1",
        "-interaction=nonstopmode",
      },
    }
    vim.g.vimtex_quickfix_mode = 1
    vim.g.vimtex_mappings_enable = 0
    vim.g.vimtex_indent_enabled = 1
    vim.g.imaps_enabled = 0
    vim.o.conceallevel = 1
    vim.vimtex_syntax_conceal = 1
    vim.g.vimtex_syntax_conceal = {
      accents = 1,
      ligatures = 1,
      cites = 1,
      fancy = 1,
      spacing = 1,
      greek = 1,
      math_bounds = 1,
      math_delimiters = 1,
      math_fracs = 1,
      math_super_sub = 0,
      math_symbols = 1,
      sections = 0,
      styles = 1,
    }
    vim.g.vimtex_log_ignore = {
      "Underfull",
      "Overfull",
      "specifier changed to",
      "Token not allowed in PDF string",
    }
    vim.g.vimtex_syntax_custom_cmds = {
      -- {
      --   mathmode = true,
      --   name = ",",
      --   concealchar = " ",
      -- },
      { -- mdif
        mathmode = true,
        name = "mdif",
        concealchar = "D",
      },
      { -- odif
        mathmode = true,
        name = "odif",
        concealchar = "d",
      },
      { -- fdif
        mathmode = true,
        name = "fdif",
        concealchar = "δ",
      },
      { -- adif
        mathmode = true,
        name = "adif",
        concealchar = "Δ",
      },
      { -- jdif
        mathmode = true,
        name = "jdif",
        concealchar = "",
      },
      { -- gdif
        mathmode = true,
        name = "gdif",
        concealchar = "",
      },
    }
    vim.g.vimtex_syntax_custom_cmds_with_concealed_delims = {
      {
        mathmode = true,
        name = "myrange",
        nargs = 1,
        cchar_open = "[",
        cchar_close = "]",
      },
      {
        mathmode = true,
        name = "myrangel",
        nargs = 1,
        cchar_open = "]",
        cchar_close = "]",
      },
      {
        mathmode = true,
        name = "myranger",
        nargs = 1,
        cchar_open = "[",
        cchar_close = "[",
      },
      {
        mathmode = true,
        name = "myrangelr",
        nargs = 1,
        cchar_open = "]",
        cchar_close = "[",
      },
      {
        mathmode = true,
        nargs= 1,
        name = "myVert",
        cchar_open = "",
        cchar_close = ""
      },
      {
        mathmode = true,
        nargs= 1,
        name = "myvert",
        cchar_open = "|",
        cchar_close = "|"
      }
      -- {
      --   mathmode= true,
      --   name = "myrange*",
      --   nargs = 2,
      --   cchar_open = "]",
      --   cchar_close = "["
      -- }
    }
  end,
}

VimtexInfo

OS: macOS 14.6.1 (23G93)
  Vim version: NVIM v0.10.1
  Has clientserver: true
  Servername: /var/folders/5f/hn34hzl13y907124_kr68p380000gn/T/nvim.felipepinto/BZxJyY/nvim.76509.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions