Detecting the Current File Type

When we went over the directories that can be used in a Vim plugin, back in The Structure of a Vim Plugin, I mentioned the specialized ftdetect directory. In the average plugin, we probably wouldn’t need to use this directory. Its entire purpose is to hold script files that detect the type of the file we’re editing—and it turns out that one popular way to have the script files do that is to have them use autocommands.

Get The VimL Primer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.