Text::Editor::Vip::Buffer::Plugins::InsertConstruct- Vip::Buffer plugin
$buffer->InsertAlignedWithTab("XXXXX") ; $buffer->Insert($text) ; $buffer->SetModificationPosition(0, 4) ; $buffer->SetSelectionBoundaries(1, 0, 3, 0) ; $buffer->InsertConstruct($text_to_insert) ;
InsertAligned takes a string as argument
Inserts a construct at the cursor position or around the selection if any if a selection is present the construct is aligned on the block and the selection is indented.
$if_construct= <<EOT ; if() \t{ \t} else \t{ \tSELECTION \t} EOT $buffer->Insert(<<EOT) ; line 1 - 1 line 2 - 2 2 line 3 - 3 3 3 EOT $buffer->SetModificationPosition(3, 4) ; $buffer->SetSelectionBoundaries(1, 0, 2, 0) ; # select the second line $buffer->InsertConstruct($if_construct) ;
Buffer content is now
line 1 - 1 if() \t{ \t} else \t{ \tline 2 - 2 2 # this line was moved in the construct and aligned \t} line 3 - 3 3 3
Khemir Nadim ibn Hamouda CPAN ID: NKH mailto:nadim@khemir.net http:// no web site
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Text::Editor::Vip, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Editor::Vip
CPAN shell
perl -MCPAN -e shell install Text::Editor::Vip
For more information on module installation, please visit the detailed CPAN module installation guide.