Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Key Bindings

jacobslusser edited this page May 31, 2015 · 2 revisions

When a new Scintilla instance is created, there are a number key bindings set by default. All default bindings can be cleared in one fell swoop using the ClearCmdKeys method, or individually using the ClearCmdKey method.

To disable the use of CTRL+V as a shortcut for paste:

scintilla.ClearCmdKey(Keys.Control | Keys.V);

An alternative way would be to assign Command.Null to the CTRL+V keys:

scintilla.AssignCmdKey(Keys.Control | Keys.V, Command.Null);

If, for example, you wanted to provide an option in your editor where holding the CTRL key would enable a Vi (or Vim) style of caret movement with the H, J, K, and L keys:

scintilla.AssignCmdKey(Keys.Control | Keys.H, Command.CharLeft);
scintilla.AssignCmdKey(Keys.Control | Keys.J, Command.LineDown);
scintilla.AssignCmdKey(Keys.Control | Keys.K, Command.LineUp);
scintilla.AssignCmdKey(Keys.Control | Keys.L, Command.CharRight);

TIP: You can execute a Command using the ExecuteCmd method without having to bind it to a key combination if you just want to perform the command programmatically.