*if_perl.txt* For Vim version 5.0f. Last modification: 1997 Apr 1 VIM REFERENCE MANUAL by Bram Moolenaar [This document is still under construction] EDITING PERL FILES *perl* *perl-editing* [should add some info about Perl highlighting here] To use tags with Perl, you need a script that generates the tags file from a Perl script. Here's the URL for two of these: COMPILING VIM WITH PERL INTERFACE *perl-compiling* To compile Vim with Perl interface, you need the MOST RECENT Perl 5.003 installed. It won't work with the 5.003 version that has been officially released! You need something like Perl 5.003_05. The Perl patches for Vim were made by Sven Verdoolaege USING PERL IN VIM *perl-using* *:perl* *:pe* :pe[rl] {cmd} Execute Perl command {cmd}. {not in Vi} *:perldo* *:perld* :[range]perld[o] {cmd} Execute Perl command {cmd} for each line in the [range] (default whole file). {not in Vi} Here're some things you can try: :perl $a=1 :perldo $_=reverse($_);1 :perl Msg("hello") :perl $line = $curwin->Buffer->GetLine(42) *perl-overview* Here is an overview of the functions that are available to Perl: perl VI::Msg("Text") # displays a message perl VI::SetOption("ai") # sets a vim option perl VI::GetMaxBufNr() # returns maximum buffer number perl VI::ValidBufNr(nr) # returns true if buffer number "nr" exists perl VI::Nr2Buffer(nr) # returns Buffer "nr" perl VI::GetMaxWinNr() # returns number of windows perl VI::Nr2Window(nr) # returns Window "nr" perl $curwin->SetHeight(10) # sets the window height perl $curwin->GetCursor() # returns (row, col) array perl $curwin->SetCursor(10,10) # sets cursor to row 10 col 10 perl $curwin->Buffer->Name() # returns buffer name perl $curwin->Buffer->LineCount() # returns the number of lines perl $curwin->Buffer->GetLine(10) # returns line 10 perl $curwin->Buffer->DelLine(10) # deletes line 10 perl $curwin->Buffer->AppendLine(10, "Line") # appends a line perl $curwin->Buffer->SetLine(10, "Line") # replaces line 10 *perl-Msg* VI::Msg({message}) Displays the message {message}. *perl-SetOption* VI::SetOption({arg}) Sets a vim option. {arg} can be any argument that the ":set" command accepts. Note that this means that no spaces are allowed in the argument! See |:set|. *perl-GetMaxBufNr* VI::GetMaxBufNr() Returns the highest Buffer number. Note that some Buffers may have been deleted, not all numbers between 1 and the maximum are always valid. *perl-ValidBufNr* VI::ValidBufNr({nr}) Returns non-zero if Buffer number {nr} exists, zero if it does not exist. *perl-Nr2Buffer* VI::Nr2Buffer({nr}) Returns Buffer {nr}. When Buffer {nr} doesn't exist, it returns the current Buffer. VI::GetMaxWinNr() Returns number of Windows currently on the screen. *perl-Nr2Window* VI::Nr2Window({nr}) Returns Window {nr}. When Window {nr} doesn't exist, it returns the current Window. *perl-SetHeight* Window->SetHeight({height}) Sets the Window height to {height}. The resulting height is limited by the height of the screen. *perl-GetCursor* Window->GetCursor() Returns (row, col) array for the current cursor position in the Window. *perl-SetCursor* Window->SetCursor({row},{col}) Positions the cursor in the Window to row {row} col {col}. If this is not on an existing character, it is moved to the nearest character. *perl-Name* Buffer->Name() Returns the filename for the Buffer. *perl-LineCount* Buffer->LineCount() Returns the number of lines in the Buffer. *perl-GetLine* Buffer->GetLine({lnum}) Returns the text string of line {lnum} in the Buffer. *perl-DelLine* Buffer->DelLine({lnum}) Deletes line {lnum} in the Buffer. *perl-AppendLine* Buffer->AppendLine({lnum}, {line}) Appends the string {line} after line {lnum} in the Buffer. *perl-SetLine* Buffer->SetLine({lnum}, {line}) Replaces line {lnum} with string {line}. If the arguments are invalid, the line is not replaced. vim:tw=78:ts=8:sw=8: