"########################################### "# linenum.vim - Print listing with numbers "# Mike Schilli, 2007 (m@perlmeister.com) "########################################### :function! Linenum() :if !has('perl') :echo "Sorry, no Perl!" return :endif perl <Count()); for $num (1..$curbuf->Count()) { $newline = sprintf "%0.*d %s", $numlen, $num, $curbuf->Get($num); $curbuf->Set($num, $newline); } EOT :endfunction :command! Linenum :call Linenum()