Index: configure.in
===================================================================
--- configure.in	(revision 660)
+++ configure.in	(working copy)
@@ -91,6 +91,18 @@
   AC_PATH_PROG([HIGHLIGHT], [highlight])
   if test -n "$HIGHLIGHT"; then
     HIGHLIGHT_OPTIONS="-X -f"
+  else
+    AC_PATH_PROG([HIGHLIGHT], [vim])
+    if test -n "$HIGHLIGHT"; then
+      dnl vim is useless if it does not support syntax highlighting
+      AC_MSG_CHECKING([whether vim has +syntax feature])
+      if $HIGHLIGHT --version | grep '+syntax' >/dev/null; then
+        AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        HIGHLIGHT=
+      fi
+    fi
   fi
 fi
 AC_SUBST([HIGHLIGHT_OPTIONS])
Index: gtkdoc-fixxref.in
===================================================================
--- gtkdoc-fixxref.in	(revision 660)
+++ gtkdoc-fixxref.in	(working copy)
@@ -238,7 +238,12 @@
     close (HTMLFILE);
     
     if ("@HIGHLIGHT@" ne "") {
-        $entire_file =~ s%<div class=\"(example-contents|informalexample)\"><pre class=\"programlisting\">(.*?)</pre></div>%&HighlightSource($1,$2);%gse;
+        if ("@HIGHLIGHT@" =~ m%/vim$%) {
+            $entire_file =~ s%<div class=\"(example-contents|informalexample)\"><pre class=\"programlisting\">(.*?)</pre></div>%&HighlightSourceVim($1,$2);%gse;
+        }
+        else {
+            $entire_file =~ s%<div class=\"(example-contents|informalexample)\"><pre class=\"programlisting\">(.*?)</pre></div>%&HighlightSource($1,$2);%gse;
+        }
         # from the highlighter we get all the functions marked up
         # now we could turn them into GTKDOCLINK items
         $entire_file =~ s%(<span class=\"function\">)(.*?)(</span>)%&MakeGtkDocLink($1,$2,$3);%gse;
@@ -341,6 +346,63 @@
 }
 
 
+sub HighlightSourceVim {
+    my ($type, $source) = @_;
+
+    # chop of leading and trailing empty lines
+    $source =~ s/^[\s\n]+//gs;
+    $source =~ s/[\s\n]+$//gs;
+    # avoid double entity replacement
+    $source =~ s/&lt;/</g;
+    $source =~ s/&gt;/>/g;
+    $source =~ s/&amp;/&/g;
+
+    # write source to a temp file
+    my $temp_source_file="$MODULE_DIR/_temp_src.$$.h";
+    open (NEWFILE, ">$temp_source_file") || die "Can't open $temp_source_file: $!";
+    print NEWFILE $source;
+    close (NEWFILE);
+
+    # format source
+    system "echo 'let html_number_lines=0|let html_use_css=1|let use_xhtml=1|syn on|e $temp_source_file|run! syntax/2html.vim|wa!|qa!' | @HIGHLIGHT@ -n -e -u /dev/null -T xterm >/dev/null";
+
+    my $highlighted_source;
+    {
+        local $/;
+        open (NEWFILE, "<$temp_source_file.html");
+        $highlighted_source = <NEWFILE>;
+        close (NEWFILE);
+    }
+    $highlighted_source =~ s#.*<pre>\n##s;
+    $highlighted_source =~ s#</pre>.*##s;
+    
+    # need to rewrite the stylesheet classes
+    # FIXME: Vim has somewhat different syntax groups
+    $highlighted_source =~ s%<span class="Comment">%<span class="comment">%gs;
+    $highlighted_source =~ s%<span class="PreProc">%<span class="preproc">%gs;
+    $highlighted_source =~ s%<span class="Statement">%<span class="function">%gs;
+    $highlighted_source =~ s%<span class="Identifier">%<span class="keyword">%gs;
+    $highlighted_source =~ s%<span class="Constant">%<span class="number">%gs;
+    $highlighted_source =~ s%<span class="Special">%<span class="symbol">%gs;
+    $highlighted_source =~ s%<span class="Type">%<span class="string">%gs;
+    
+    # chop of leading and trailing empty lines
+    $highlighted_source =~ s/^[\s\n]+//gs;
+    $highlighted_source =~ s/[\s\n]+$//gs;
+    # we should do own line-numbering
+    $highlighted_source =~ s%^(.*)$%<li>$1</li>%gm;
+    $highlighted_source =~ s%<li></li>%<li>&nbsp;</li>%gm;
+
+    # remove temp files
+    unlink ($temp_source_file)
+	|| die "Can't delete $temp_source_file: $!";
+    unlink ("$temp_source_file.html")
+	|| die "Can't delete $temp_source_file.html: $!";
+
+    return "<div class=\"$type\"><ol class=\"code\">$highlighted_source</ol></div>";
+}
+
+
 #############################################################################
 # Function    : CreateValidSGMLID
 # Description : Creates a valid SGML 'id' from the given string.
