It is unclear why you are using the
after directory. From
5. In the "after" directory in your home directory. This is for
personal preferences to overrule or add to the distributed defaults
or system-wide settings (rarely needed).
So unless you are overwriting the
ftplugin preferences from a plugin, you should use the
.vim/ftplugin/processing.vim. For details you check
:help filetype-plugin and
The filetype detection could also be done without the
after, as explained in
:help new-filetype. One of the recommend ways it to use the
C. If your file type can be detected by the file name.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Example for Unix: >
2. Create a file that contains autocommands to detect the file type.
" my filetype file
au! BufRead,BufNewFile *.mine setfiletype mine
au! BufRead,BufNewFile *.xyz setfiletype drawing
Write this file as "filetype.vim" in your user runtime directory. For
example, for Unix: >
I moved ftdetect and ftplugin out of ~/.vim/after/ to ~/.vim/ but it doesn’t change anything.
Indeed, I tried it here with the same results. As suggested in the comments,
:verbose set syntax? showed the culprit:
" Set up the connection between FileType and Syntax autocommands.
" This makes the syntax automatically set when the file type is detected.
au! FileType * exe "set syntax=" . expand("<amatch>")
FileType When the 'filetype' option has been set. (...)
So despite you set the syntax correctly, after your
ftplugin is loaded the autocmd above overwrites it.
As this is in the Vim runtime files, you shouldn't change it. So one option would be to set the filetype to java, and on the java
ftplugincheck the file extension (e.g.: using
expand("%:e")) and set the pde options instead of the java options.
Another approach would be delaying the setting of the syntax until the filetype is finished:
autocmd Syntax <buffer> call SetPdeSyntax()
" remove the augroup