Text-Editor-Vip

 view release on metacpan or  search on metacpan

lib/Text/Editor/Vip/Setup/Actions/default_actions.pl  view on Meta::CPAN

	, [ undef , 'KP_Home',   '000' => 'Home', '000' ]

	, [ undef , 'End',       '000' => sub{$_[BUFFER]->MoveToEndOfLine();} ]
	, [ undef , 'KP_End',    '000' => 'End', '000']

	#~ , [ undef , 'Page_Up',   '000' => sub{$_[BUFFER]->;} ]
	#~ , [ undef , 'KP_Page_Up','000' => sub{$_[BUFFER]->;} ]
	#~ , [ undef , 'Page_Down', '000' => sub{$_[BUFFER]->;} ]
	#~ , [ undef , 'KP_Page_Down', '000'  => sub{$_[BUFFER]->;} ]

	#~ , [ undef , 'Escape', '000'        => sub{$_[BUFFER]->;} ]

	#~ , [ undef , 'Insert',    '000' => sub{$_[BUFFER]->;} ]
	#~ , [ undef , 'KP_Insert', '000' => sub{$_[BUFFER]->;} ]

	) ;

#-------------------------------------------------------------------------------
# case

$buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Plugins::Case') ;

$actions->RegisterActions
	(
	  [ 'Make selection upper case', 'u', 'C00' => sub {$_[BUFFER]->MakeSelectionUpperCase() ;}]
	, [ 'Make selection lower case', 'U', 'C0S' => sub {$_[BUFFER]->MakeSelectionLowerCase() ;}]
	) ;
	

#-------------------------------------------------------------------------------
# selection

$buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Plugins::Selection') ;
$buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Plugins::Clipboard') ;

$actions->RegisterActions
	(
	  [ 'Select all'                          , 'a'           , 'C00' => sub {$_[BUFFER]->SelectAll() ;}]
	
	#~ , [ 'Select line'                             , 'Triple_click'  , '000' => sub {$_[BUFFER]->SelectLine]

	, [ 'Select word'                  , 'LEFT_DOUBLE_CLICK'  , '000' => sub {$_[BUFFER]->SelectWord() ;}]
	, [ 'Select word'                         , 'Left_click'  , 'C00' => 'LEFT_DOUBLE_CLICK'  , '000']
	, [ 'Select word'                         , 'space'       , 'C0S' => 'LEFT_DOUBLE_CLICK'  , '000']
	
	, [ 'Extend selection'                    , 'Left_click'  , '00S' => sub {$_[BUFFER]->ExtendSelection() ;}]
	, [ 'Extend selection to end of line'     , 'End'         , '00S' => sub {$_[BUFFER]->ExtendSelectionToEndOfLine() ;}]
	, [ 'Extend selection to end of document' , 'End'         , 'C0S' => sub {$_[BUFFER]->ExtendSelectionToEndOfBuffer() ;}]
	, [ 'Extend selection to top of document' , 'Home'        , 'C0S' => sub {$_[BUFFER]->ExtendSelectionToStartOfBuffer() ;}]
	, [ 'Extend selection home'               , 'Home'        , '00S' => sub {$_[BUFFER]->ExtendSelectionHome() ;}]
	, [ 'Extend selection left'               , 'Left'        , '00S' => sub {$_[BUFFER]->ExtendSelectionLeft() ;}]
	, [ 'Extend selection right'              , 'Right'       , '00S' => sub {$_[BUFFER]->ExtendSelectionRight() ;}]
	, [ 'Extend selection to next word'       , 'Right'       , 'C0S' => sub {$_[BUFFER]->ExtendSelectionToNextWord() ;}]
	, [ 'Extend selection to previous word'   , 'Left'        , 'C0S' => sub {$_[BUFFER]->ExtendSelectionToPreviousWord() ;}]
	, [ 'Extend selection up'                 , 'Up'          , '00S' => sub {$_[BUFFER]->ExtendSelectionUp() ;}]
	, [ 'Extend selection down'               , 'Down'        , '00S' => sub {$_[BUFFER]->ExtendSelectionDown() ;}]
	
	#~ , [ 'Extend selection page up'                , 'Prior'       , '00S' => sub {$_[BUFFER]->ExtendSelectionPageUp() ;}]
	#~ , [ 'Extend selection page down'              , 'Next'        , '00S' => sub {$_[BUFFER]->ExtendSelectionPageDown() ;}]
	
	, [ 'Copy selection to systemclipboard'   , 'Insert'      , 'C00' => sub {$_[BUFFER]->PrintError("copy to main clipboard unimplemented!") ;}]
	, [ 'Insert system clipboard contents'    , 'Insert'      , '00S' => sub {$_[BUFFER]->PrintError("paste from main clipboard unimplemented!") ;}]
	
	, [ 'Copy selection to clipboard 1'       , '&'           , 'C00' => sub {$_[BUFFER]->CopySelectionToClipboard(1) ;}]
	, [ 'Insert clipboard contents 1'         , '1'           , 'C0S' => sub {$_[BUFFER]->InsertClipboardContents(1) ;}]
	, [ 'Copy selection to clipboard 2'       , 'é'           , 'C00' => sub {$_[BUFFER]->CopySelectionToClipboard(2) ;}]
	, [ 'Insert clipboard contents 2'         , '2'           , 'C0S' => sub {$_[BUFFER]->InsertClipboardContents(2) ;}]
	, [ 'Copy selection to clipboard 3'       , '"'           , 'C00' => sub {$_[BUFFER]->CopySelectionToClipboard(3) ;}]
	, [ 'Insert clipboard contents 3'         , '3'           , 'C0S' => sub {$_[BUFFER]->InsertClipboardContents(3) ;}]
	, [ 'Copy selection to clipboard 4'       , "'"           , 'C00' => sub {$_[BUFFER]->CopySelectionToClipboard(4) ;}]
	, [ 'Insert clipboard contents 4'         , '4'           , 'C0S' => sub {$_[BUFFER]->InsertClipboardContents(5) ;}]
	) ;

# display

$actions->RegisterActions
	(
	  [ 'Center current line in display', 'C'       , 'C0S' => sub {$_[VIEW]->CenterCurrentLineInDisplay() ;}]
	, [ 'Flip display size'             , 'Return'  , 'C00' => sub {$_[VIEW]->FlipDisplaySize() ;}]
	, [ 'Flip line number display'      , 'L'       , '0A0' => sub {$_[VIEW]->FlipLineNumberDisplay() ;}]
	, [ 'display tab stops'             , 'T'       , '0A0' => sub {$_[VIEW]->DisplayTabStops() ;}]
	, [ 'Reduce tab size'               , 'Subtract', '0A0' => sub {$_[VIEW]->ReduceTabSize() ;}]
	, [ 'Expand tab size'               , 'Add'     , '0A0' => sub {$_[VIEW]->ExpandTabSize() ;}]
	) ;

}


#------------------------------------------------------------------------------------------------------

sub InsertCharacter
{
my (undef, undef, $buffer, $key) = @_ ;
$buffer->Insert($key) ;
} ;

#------------------------------------------------------------------------------------------------------

sub InsertNewLine {$_[BUFFER]->Insert("\n") ;} ;

#------------------------------------------------------------------------------------------------------
1 ;

__END__

#-------------------------------------------------------------------------------

#  called by CPP smed
#$this->AddCommand('000NEW_SELECTION'    , 'Smed::ExtendSelection()') ;

#-------------------------------------------------------------------------------

# insert, delete

$this->AddCommand('000DELETE', 'Delete',    \&Smed::Delete) ;
$this->AddCommand('000BACK',   'Backspace', \&Smed::BackspaceOne) ;

$this->AddCommand('000RETURN'   , 'Insert new line',               \&Smed::InsertNewLine) ;
$this->AddCommand('CS0L'        , 'Insert new line before current',\&Smed::InsertNewLineBeforeCurrent) ;
$this->AddCommand('C00L'        , 'Delete line',                   \&Smed::DeleteLine) ;
$this->AddCommand('C00BACK'     , 'Delete to begining of line',    \&Smed::DeleteToBeginingOfWord) ;
$this->AddCommand('C00DELETE'   , 'Delete to end of word',         \&Smed::DeleteToEndOfWord) ;
$this->AddCommand('000SPACE'    , 'Insert space',                  \&Smed::InsertSpace) ;
$this->AddCommand('000TAB'      , 'Insert tab',                    \&Smed::InsertTab) ;
$this->AddCommand('0S0TAB'      , 'Remove tab from selection',     \&Smed::RemoveTabFromSelection) ;

#--------------------------------------------------------------------------) ;
# movement

$this->AddCommand('C00G', 'Goto line and character', \&Smed::GotoLine) ;



( run in 1.228 second using v1.01-cache-2.11-cpan-84e82930d8c )