Skip to content

insert en

Hamatoma edited this page Aug 12, 2022 · 2 revisions

This allows texts to be entered in a buffer. The position of the inset is a line number or a search expression. There can be a condition (existence of a search expression) to ignore the insertion.

Table of Contents

Parameters

Name Type Description Example
input bufferName The text from this buffer is examined. Default: input input=data
output bufferName The result is written to this buffer. Default: output output=result
at nat The line number (counting from 1) at which to insert. The value 0 means: at the end of the buffer. This parameter excludes the "position" parameter. at=1
above bool The insertion takes place above the line with the search string. above
position pattern A search expression that determines the insertion position. This parameter excludes the "at" parameter. position="[debug]"
position=R/\[(debug|production)\]/
exclusion pattern If this search expression is found, no insertion occurs. position="[debug]"
position=R/^bufferSize\s*=/
what string This is the text that will be pasted. what=i%"line1%nline2%n"
what=i%"%buffer3"

Examples

Example 1: Inserting an HTML frame

In the buffer html is:

<h1>Welcome</h1>
<p>Read and enjoy!</p>
Command:
insert in=html out=html at=1 what=i%"<html>%n<body>" exclusion=r/<body>/
insert in=html out=html at=0 what=i%"</body>%n</html>" exclusion=r%</body>%
The result buffer html contains:
<html>
<body>
<h1>Welcome</h1>
<p>Read and enjoy!</p>
</body>
</html>
If the commands are executed a second time, the content of the html buffer does not change.

Example 2: Entry of parameters in a PHP environment

In the buffer input the content of php.ini Command:

input position=/[opcache]/ what=i%"opcache.enable=1%nopcache.enable_cli=1%nopcache.memory_consumption=512" exclude=r/^opcache.enabled/

Clone this wiki locally