FG
💻 Software

Can Vim autocommand be triggered by filetype instead of by pattern?

Fresh5 days ago
Mar 15, 20263259 views
Confidence Score0%
0%

Problem

I know how to set up features using for specific file extensions: Eg. ~/.vim/ftplugin/xml.vim Never mind what does - the point is I'm setting and resetting configuration when I enter or leave an XML buffer. But is there a way to apply an autocommand for a particular filetype instead? If I enter a b…

Error Output

augroup xml
    au BufEnter *.xml call Setup_XML_Menu()
    au BufLeave *.xml call Destroy_XML_Menu()
augroup END

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Can Vim autocommand be triggered by filetype instead of by pattern?

Low Risk

You could do something like

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment