Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1115119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:06:37+00:00 2026-05-17T03:06:37+00:00

I currently have a syntax file that parses a log file, very similar to

  • 0

I currently have a syntax file that parses a log file, very similar to the following [this is for syslog]:

syn match   syslogText  /.*$/
syn match   syslogFacility  /.\{-1,}:/  nextgroup=syslogText skipwhite
syn match   syslogHost  /\S\+/  nextgroup=syslogFacility,syslogText skipwhite
syn match   syslogDate  /^.\{-}\d\d:\d\d:\d\d/  nextgroup=syslogHost skipwhite

I’d like to, using a map, toggle whether a given group (let’s say, syslogHost) is concealed or not. Is there any way to do something like the following pseudocode:

map <leader>ch :syn match syslogHost conceal!

and thereby toggle the definition of syslogHost between:

syn match   syslogHost  /\S\+/  nextgroup=syslogFacility,syslogText skipwhite

and

syn match   syslogHost  /\S\+/  nextgroup=syslogFacility,syslogText skipwhite conceal

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T03:06:37+00:00Added an answer on May 17, 2026 at 3:06 am

    I think the only way to do this is with a function:

    map <leader>ch :call ToggleGroupConceal('sysLogHost')<CR>
    
    function! ToggleGroupConceal(group)
        " Get the existing syntax definition
        redir => syntax_def
        exe 'silent syn list' a:group
        redir END
        " Split into multiple lines
        let lines = split(syntax_def, "\n")
        " Clear the existing syntax definitions
        exe 'syn clear' a:group
        for line in lines
                " Only parse the lines that mention the desired group
                " (so don't try to parse the "--- Syntax items ---" line)
            if line =~ a:group
                        " Get the required bits (the syntax type and the full definition)
                let matcher = a:group . '\s\+xxx\s\+\(\k\+\)\s\+\(.*\)'
                let type = substitute(line, matcher, '\1', '')
                let definition = substitute(line, matcher, '\2', '')
                        " Either add or remove 'conceal' from the definition
                if definition =~ 'conceal'
                    let definition = substitute(definition, ' conceal\>', '', '')
                    exe 'syn' type a:group definition
                else
                    exe 'syn' type a:group definition 'conceal'
                endif
            endif
        endfor
    endfunction
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this code that works. I have two questions. How do I
Currently have a drop down menu that is activated on a hover (from display:none
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I currently have one project that currently contains multiple packages. These packages make up
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies
I'm really quite frustrated at this point. I have an existing hg repository that
I am working on a wrapper that parses a data file for an existing
I don't generally write batches , but I currently have a batch that uses
I have the following code for grepping an xml file repo, in ant :
I am struggling with this one: I have this simple module in a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.