function! Idate() " output a date in the format for "Install.txt" files: " 15 August 2014 " -------------- " get the date in the desired format: let mydate=strftime("%d %B %Y") " find the length of the date: let mylen=len(mydate) " provide an indent: let indent=" " " indent the date: let mydate=indent . mydate " Check if autoindent: if so, don't prepend spaces of second line: if &ai==#'0' let underline=indent else let underline="" endif let i=0 " Add dashes to the length of the date: while i < mylen let underline=underline . "-" let i+=1 endwhile let mydate=mydate . "\n" . underline . "\n" " Give us some output: return mydate endfunction " is Control-R, insert the contents of a register. "=" is the " expression register. :help i_CTRL-R inoremap ,d =Idate()