ciaranm / securemodelines

A secure alternative to Vim modelines
107 stars 29 forks source link

Delay modeline evaluation by moving plugin to after directory #26

Open kevinoid opened 5 years ago

kevinoid commented 5 years ago

This plugin evaluates the modeline during the autocmd BufRead event, which occurs before the modeline would normally be evaluated and, more importantly, before :filetype detect. This causes a filetype set in a modeline (e.g. // vim: set ft=foo :) not to work in cases that filetype is set in ~/.vim/filetype.vim or a ftdetect script from a package.

This commit fixes the issue by moving the plugin to the package after directory which causes autocmd BufRead to be executed after :filetype detect as it would be if this plugin were not installed, which makes filetype (and any other settings) from the modeline override settings from ftdetect as they normally would.

Fixes: #20