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

  • Home
  • SEARCH
  • 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 8562749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:47:54+00:00 2026-06-11T16:47:54+00:00

I frequently open whole sets of file at once from inside MacVim. To do

  • 0

I frequently open whole sets of file at once from inside MacVim. To do this, I typically use the commands:

args *PATTERN*
argdo tabedit

This loads all files in the working directory that match the pattern into the argument list, and then opens them all in separate tabs. Syntax highlighting is not automatically turned on when I do this and I have to set it manually. How can I fix this?

  • 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-06-11T16:47:55+00:00Added an answer on June 11, 2026 at 4:47 pm

    I had already posted a workaround for :bufdo in a similar question; here is an extended version that handles your use case, too. Working around the automatic setting of 'eventignore' is quite tricky, therefore it’s amply commented:

    " Enable syntax highlighting when buffers are displayed in a window through
    " :argdo and :bufdo, which disable the Syntax autocmd event to speed up
    " processing.
    augroup EnableSyntaxHighlighting
        " Filetype processing does happen, so we can detect a buffer initially
        " loaded during :argdo / :bufdo through a set filetype, but missing
        " b:current_syntax. Also don't do this when the user explicitly turned off
        " syntax highlighting via :syntax off.
        " The following autocmd is triggered twice:
        " 1. During the :...do iteration, where it is inactive, because
        " 'eventignore' includes "Syntax". This speeds up the iteration itself.
        " 2. After the iteration, when the user re-enters a buffer / window that was
        " loaded during the iteration. Here is becomes active and enables syntax
        " highlighting. Since that is done buffer after buffer, the delay doesn't
        " matter so much.
        " Note: When the :...do command itself edits the window (e.g. :argdo
        " tabedit), the BufWinEnter event won't fire and enable the syntax when the
        " window is re-visited. We need to hook into WinEnter, too. Note that for
        " :argdo split, each window only gets syntax highlighting as it is entered.
        " Alternatively, we could directly activate the normally effectless :syntax
        " enable through :set eventignore-=Syntax, but that would also cause the
        " slowdown during the iteration Vim wants to avoid.
        " Note: Must allow nesting of autocmds so that the :syntax enable triggers
        " the ColorScheme event. Otherwise, some highlighting groups may not be
        " restored properly.
        autocmd! BufWinEnter,WinEnter * nested if exists('syntax_on') && ! exists('b:current_syntax') && ! empty(&l:filetype) && index(split(&eventignore, ','), 'Syntax') == -1 | syntax enable | endif
    
        " The above does not handle reloading via :bufdo edit!, because the
        " b:current_syntax variable is not cleared by that. During the :bufdo,
        " 'eventignore' contains "Syntax", so this can be used to detect this
        " situation when the file is re-read into the buffer. Due to the
        " 'eventignore', an immediate :syntax enable is ignored, but by clearing
        " b:current_syntax, the above handler will do this when the reloaded buffer
        " is displayed in a window again.
        autocmd! BufRead * if exists('syntax_on') && exists('b:current_syntax') && ! empty(&l:filetype) && index(split(&eventignore, ','), 'Syntax') != -1 | unlet! b:current_syntax | endif
    augroup END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Ruby I frequently use File.dirname(__FILE__) to open configuration files and such. For those
I frequently use the two functions below to read the contents of a file
I'm using a open-source library for i2c bus actions. This library frequently uses a
I have a program i frequently use that is made with .NET. This program
After joining SO, I am frequently seeing this kind of syntax whenever I open
This happens to me quite frequently...at least once every 1 or 2 weeks...and it
I'm making use of an open source project that is changing quite frequently. It
Why can't open generic types be passed as parameters. I frequently have classes like:
Frequently I copy and paste code from my existing code base. Eclipse frequently brings
I frequently use git stash and git stash pop to save and restore changes

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.