Thomas schrieb:
Hi,

When I set a filetype for a buffer the variable b:did_ftplugin is set.

The help says:

If you are writing a filetype plugin to be used by many people, they need a
chance to disable loading it.  Put this at the top of the plugin: >

    " Only do this when not done yet for this buffer
    if exists("b:did_ftplugin")
      finish
    endif
    let b:did_ftplugin = 1

Now, when I do set ft=X from the command line, it happens that the ftplugin X doesn't get loaded because it finishes when b:did_ftplugin is set.

When is b:did_ftplugin ever unset? What's the rationale of setting b:did_ftplugin and not b:did_ftplugin_X?

Regards,
Thomas.

ftplugins should define b:undo_ftplugin .
   :h undo_ftplugin
If this var exists and its commands get executed then (only then) also
b:did_ftplugin will be unset.

Executing b:undo_ftplugin is one of the first things  :setf X  tries
to do.

--
Regards,
Andy

EOM

Reply via email to