" Setting nocompatible here because this setting can effect other settings.
" The vim help suggests this as the first setting because of the side effects.
set nocompatible

" Load from init.d instead of plugin directory. This is done so a leader key
" can be set before loading plugin settings. This allows the plugin setting
" files to set mappings with leader keys
for f in split(glob($XDG_CONFIG_HOME.'/vim/init.d/*.vim'), '\n')
    execute 'source '.fnameescape(f)
endfor

" The plugged plugin manager function calls need to be called between the
" plug#begin and plug#end. Because of that, using the normal plugin directory
" loading won't work.
call plug#begin($XDG_DATA_HOME.'/vim/plugged')
for f in split(glob($XDG_CONFIG_HOME.'/vim/plug.d/*.vim'), '\n')
    execute 'source '.fnameescape(f)
endfor
call plug#end()