I wanted to get this down since I find myself playing with plugins, but would like to not have to delete configuration of it in the event I need it again. There are also plugins that interact with eachother and I'd like to gracefully degrade if a plugin is not there. This is one option, to check the runtimepath of the system after the vimrc has ran.
From what I can tell, the only way to do this inside the vimrc would be to traverse all of the pack directories for the existence of the plugin, which seems duplicative of what vim already does.
The following should not be used in the vimrc, since the runtimepath is not yet set till after that happens. Any plugin configuration which depends on a check must be at least in the plugins folder, if not in the after folder somewhere.
Note: This is for plugins that use the packages feature of vim and are auto loaded in the start folder or you have manually packadd! them in your vimrc. This will have no idea a plugin is in the opt directory since it's not added to the runtimepath until 'packadd'ed.
Usage:
if (PluginExists('vim-rails'))
" do stuff
endif
function! PluginExists(plugin) abort
return stridx(&rtp, a:plugin) > -1
endfunction