You can use either autocmds:
autocmd FileType java colorscheme desert
or put the commands in ~/.vim/ftplugin/java_mycolors.vim . (This is for new settings, if you want to override the data from the standard flippins by default, you put them in ~/.vim/after/ftplugin/java.vim .)
As you can see, the first approach is quick and dirty, and the latter allows modularity and many settings. Your call.
As for color change, this is a global setting; you cannot mix them at the same time; but you will only notice that when you break windows or use tabs, however, this may be good.
However, you can change the individual syntax colors. By default, comments in all languages ββare associated with the Comment highlight group. Read the syntax file (for example, $VIMRUNTIME/syntax/java.vim ) or use the SyntaxAttr.vim plugin to determine the name of the group. Then you can override it in your .vimrc :
:highlight javaLineComment guifg=Purple :highlight javaComment guifg=Purple
This is tedious (depending on how much you want to configure), but more accurately and works in parallel. I would recommend this if you really don't need a completely different coloring for each type of file.
source share