Writing functions in vimrc is quite straight-forward. The keyword is actually:
function! and ends with endfunctionfunction! HelloWorld(param1, param2) echo 'using param1: ' . a:param1 echo 'using param2: ' . a:param2 return 0endfunction" calling the functioncall HelloWorld(expand('%:p'), expand('%p:h'))