Keybindings

gtkscintilla.Scintilla.assign_cmd_key(keydefinition, command)

The editor can perform commands associated with keybindings through this method. The keydefinition argument is a string that represents the keybinding, something common in other application, here some examples.

There are common keys:

"<Ctrl>a", "c", "<Alt>b", "<Ctrl><Shift>1"

There are also special keys: Up Down Left Right Home End Prior Next Delete Insert Escape Backspace Tab Return KPAdd KPSubtract KPDivide

That can be used alone or with modifiers (Shift Ctrl Alt Super):

"<Super>Return", "Insert", "<Ctrl><Super>Backspace"

The command argument is a constant that represent the action to execute when the keystroke is done, available actions are:

SCI_LINEDOWN SCI_LINEDOWNEXTEND SCI_LINEDOWNRECTEXTEND SCI_LINESCROLLDOWN
SCI_LINEUP SCI_LINEUPEXTEND SCI_LINEUPRECTEXTEND SCI_LINESCROLLUP
SCI_PARADOWN SCI_PARADOWNEXTEND SCI_PARAUP SCI_PARAUPEXTEND
SCI_CHARLEFT SCI_CHARLEFTEXTEND SCI_CHARLEFTRECTEXTEND  
SCI_CHARRIGHT SCI_CHARRIGHTEXTEND SCI_CHARRIGHTRECTEXTEND  
SCI_WORDLEFT SCI_WORDLEFTEXTEND SCI_WORDRIGHT SCI_WORDRIGHTEXTEND
SCI_WORDLEFTEND SCI_WORDLEFTENDEXTEND SCI_WORDRIGHTEND SCI_WORDRIGHTENDEXTEND
SCI_WORDPARTLEFT SCI_WORDPARTLEFTEXTEND SCI_WORDPARTRIGHT SCI_WORDPARTRIGHTEXTEND
SCI_HOME SCI_HOMEEXTEND [SCI_HOMERECTEXTEND]  
SCI_HOMEDISPLAY SCI_HOMEDISPLAYEXTEND SCI_HOMEWRAP SCI_HOMEWRAPEXTEND
SCI_VCHOME SCI_VCHOMEEXTEND SCI_VCHOMERECTEXTEND  
SCI_VCHOMEWRAP SCI_VCHOMEWRAPEXTEND    
SCI_LINEEND SCI_LINEENDEXTEND SCI_LINEENDRECTEXTEND  
SCI_LINEENDDISPLAY SCI_LINEENDDISPLAYEXTEND SCI_LINEENDWRAP SCI_LINEENDWRAPEXTEND
SCI_DOCUMENTSTART SCI_DOCUMENTSTARTEXTEND SCI_DOCUMENTEND SCI_DOCUMENTENDEXTEND
SCI_PAGEUP SCI_PAGEUPEXTEND SCI_PAGEUPRECTEXTEND  
SCI_PAGEDOWN SCI_PAGEDOWNEXTEND SCI_PAGEDOWNRECTEXTEND  
SCI_STUTTEREDPAGEUP SCI_STUTTEREDPAGEUPEXTEND    
SCI_STUTTEREDPAGEDOWN SCI_STUTTEREDPAGEDOWNEXTEND    
SCI_DELETEBACK SCI_DELETEBACKNOTLINE    
SCI_DELWORDLEFT SCI_DELWORDRIGHT SCI_DELWORDRIGHTEND  
SCI_DELLINELEFT SCI_DELLINERIGHT SCI_LINEDELETE  
SCI_LINECUT SCI_LINECOPY SCI_LINETRANSPOSE SCI_LINEDUPLICATE
SCI_LOWERCASE SCI_UPPERCASE SCI_CANCEL SCI_EDITTOGGLEOVERTYPE
SCI_NEWLINE SCI_FORMFEED SCI_TAB SCI_BACKTAB
SCI_SELECTIONDUPLICATE SCI_NULL    

The SCI_*EXTEND messages extend the selection.

The SCI_*RECTEXTEND messages extend the rectangular selection (and convert regular selection to rectangular one, if any).

The SCI_WORDPART* commands are used to move between word segments marked by capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).

The SCI_HOME* commands move the caret to the start of the line, while the SCI_VCHOME*commands move the caret to the first non-blank character of the line (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.

The SCI_[HOME|LINEEND]DISPLAY* commands are used when in line wrap mode to allow movement to the start or end of display lines as opposed to the normal SCI_[HOME|LINEEND] commands which move to the start or end of document lines.

The SCI_[[VC]HOME|LINEEND]WRAP* commands are like their namesakes SCI_[[VC]HOME|LINEEND]* except they behave differently when word-wrap is enabled: They go first to the start / end of the display line, like SCI_[HOME|LINEEND]DISPLAY*, but if the cursor is already at the point, it goes on to the start or end of the document line, as appropriate for SCI_[[VC]HOME|LINEEND]*.

There’s also the SCI_NULL command that is no action.

gtkscintilla.Scintilla.clear_cmd_key(keyDefinition)
This makes the given key definition do nothing by assigning the action SCI_NULL to it.
gtkscintilla.Scintilla.clear_all_cmd_keys()
This command removes all keyboard command mapping by setting an empty mapping table.

Previous topic

Searching and replacing

Next topic

Lexers

This Page