3 VI - VI module within perl embedded nvi
10 while ($i <= $VI::StopLine) {
11 $_ = VI::GetLine($VI::ScreenId, $i++);
14 VI::Msg($VI::ScreenId,"$words words");
19 This pseudo module is available to perl programs run from within nvi and
20 provides access to the files being edited and some internal data.
22 Beware that you should not use this module from within a C<perldo> or
23 from within an C<END> block or a C<DESTROY> method.
27 These are set by nvi before starting each perl command.
33 Screen id of the current screen.
37 Line number of the first line of the selected range or of the file if no
42 Line number of the last line of the selected range or of the file if no
53 VI::AppendLine(screenId,lineNumber,text);
55 Append the string text after the line in lineNumber.
59 VI::DelLine(screenId,lineNum);
65 VI::EndScreen(screenId);
73 Return the screen id associated with file name.
77 ($line, $column) = VI::GetCursor(screenId);
79 Return the current cursor position as a list with two elements.
83 VI::GetLine(screenId,lineNumber);
89 ($line, $column) = VI::GetMark(screenId,mark);
91 Return the mark's cursor position as a list with two elements.
95 VI::GetOpt(screenId,option);
97 Return the value of an option.
101 VI::InsertLine(screenId,lineNumber,text);
103 Insert the string text before the line in lineNumber.
107 VI::LastLine(screenId);
109 Return the last line in the screen.
113 VI::MapKey(screenId,key,perlproc);
115 Associate a key with a perl procedure.
119 VI::Msg(screenId,text);
121 Set the message line to text.
125 VI::NewScreen(screenId);
126 VI::NewScreen(screenId,file);
128 Create a new screen. If a filename is specified then the screen is
129 opened with that file.
133 VI::Run(screenId,cmd);
135 Run the ex command cmd.
139 VI::SetCursor(screenId,line,column);
141 Set the cursor to the line and column numbers supplied.
145 VI::SetLine(screenId,lineNumber,text);
147 Set lineNumber to the text supplied.
151 VI::SetMark(screenId,mark,line,column);
153 Set the mark to the line and column numbers supplied.
157 VI::SetOpt(screenId,command);
163 VI::SwitchScreen(screenId,screenId);
165 Change the current focus to screen.
169 VI::UnmmapKey(screenId,key);
175 This is the default warning handler.
176 It adds any warnings to the error string.
184 for $mark ('a' .. 'z') {
185 eval {VI::GetMark($VI::ScreenId, $mark)};
186 $all .= $mark unless ($@);
188 VI::Msg($VI::ScreenId,"Set marks: $all");
193 my ($i) = $VI::StartLine-1;
194 while (++$i <= $VI::StopLine) {
195 $_ = VI::GetLine($VI::ScreenId, $i);
196 VI::SetLine($VI::ScreenId, $i, $_) if(&$code);
202 :perl forall sub{s/perlre/substitution/}
204 Although you'll probably use
206 :perldo s/perlre/substitution/
210 See L<perlre> for perl regular expressions.
218 Sven Verdoolaege <skimo@dns.ufsia.ac.be>