You don't need to use an autocmd or anything, because the scripts under
ftplugin are already loaded by an autocmd triggered when the filetype is actually set.
For example, for filetype
markdown, the autocmd that loads
ftplugin is equivalent to:
autocmd FileType markdown runtime! ftplugin/markdown.vim ftplugin/markdown_*.vim ftplugin/markdown/*.vim
So you can simply add a command, such as
Goyo, to enable Goyo, inside such an
Note that you can use a
ftplugin/markdown.vim file, but if one already exists, you can also create a file named
ftplugin/markdown/goyo.vim, any and all of those will be loaded when a file with filetype
markdown is opened.
If you want to have the
Goyo command opened late, after all other
ftplugin commands for that filetype have been executed (to prevent any interference and override all previous settings), then store it under
~/.config/nvim/after/ftplugin rather than
after subdirectory is added last to
'runtimepath', so the scripts stored there are executed last.
You'll find relevant documentation under