0

I am editing a file of filetype=help and want to do something when entering in insert mode. So I put a new ftplugin in ~/.vim/ftplugin/help.vim:

" ~/.vim/ftplugin/help.vim
echom 'execute help ftplugin'
augroup filetype_help
    autocmd! " or autocmd! InsertEnter <buffer>
    autocmd InsertEnter <buffer> echom 'enter insert mode'
augroup END

But it doesn't work when I firstly enter in insert mode. I also find that it will execute the plugin code in ~/.vim/ftplugin/help.vim when firstly entering in insert mode, which will show execute help ftplugin twice.

Maybe it only appears in some vim versions, and my system environment is:

  • vim: VIM - Vi IMproved 7.4 (2013 Aug 10) containing patches: 1-207, 209-326.
  • system: openSuse 42.3
Run
  • 876
  • 6
  • 21
  • I cannot reproduce this. Do you have any plugin that may interfere here? I'd try to open a help file after `:set verbose=20` and check the (long) output for what exactly happens. – Ingo Karkat Feb 22 '19 at 07:03
  • @IngoKarkat maybe it is related to vim versions, could you tell me your vim version? – Run Feb 22 '19 at 07:10
  • Neither on Vim 7.4.1689 nor on 8.1.744 on Ubuntu. Backward compatibility is great, I doubt it's related to that. Rather caused by configuration. – Ingo Karkat Feb 22 '19 at 07:31
  • Maybe check you autocmds with `:autocmd InsertEnter`. – Ralf Feb 22 '19 at 14:23

0 Answers0