editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.13k stars 137 forks source link

Update FiletypeHook example for installation as Vim 8 package. #162

Open bcbnz opened 3 years ago

bcbnz commented 3 years ago

Packages are loaded after vimrc is parsed, so we can't add the hook immediately. Suggest using either an autocommand or a file in an after-directory to add the hook instead.

Fixes: #161 -- note rather than only one method as I suggested in the issue, I've gone with three here. The autocommand might not work for other plugin managers (if they source the file before getting to the autocommand, it won't be triggered). Using the after-directory feels less nice to me, but I included it for anybody who doesn't want to use autocommands or has an older version of vim which doesn't support the SourcePost event.

First time I've tried editing vim help files, hopefully I got all the syntax correct! It appeared to work for me :).

xuhdev commented 3 years ago

@cxw42 Could you help review this, please? I don't use Vim8 much these days and it's hard for me to review.