Keyboard Bindings
Pythonwin has a new, flexible keyboard
binding mechanism. Bindings (and even code) can be defined in a
configuration file, stored in the pywin directory.
Many bindings are still builtin to Python using Window's accelerators -
see the Pythonwin menus for the specific keyboard shortcuts.
The default configuration file is named default.cfg. You can view
this file with a text editor (eg, Pythonwin) This file has extensive
comments, including how to create your own configuration based on the
default. An example configuration which provides keyboard bindings
similar to IDLE exists in IDLE.cfg, and this makes a good example of a
custom configuration.
Please see default.cfg for a complete list, but the default bindings
provided with Pythonwin are:
Common Keystrokes
|
Description
|
| |
Alt+Q | Reformat the current paragraph/comment block. Note this does NOT reformat code correctly - use only within comment blocks! |
Ctrl+W | Toggle view whitespace. |
Alt+/ | Expand the word at the cursor. Eg, pressing "st<Alt+/>"
will complete based on all words in the current file - eg, "string"
would be likely to result assuming the code has an "import string"
statement. Pressing the key again expands to the next match. |
. | Auto expand the attribute. Eg, typing "string." will display a listbox with the contents of the string module. Select an item with TAB or the mouse. |
Alt+I | Toggle focus to/from the interactive window. |
Builtin Keystrokes
|
Keystrokes built into Scintilla
|
| |
Ctrl+Keypad+Plus | Zoom-in for the current window. Non True-Type fonts may require multiple presses. |
Ctrl+Keypad+Minus | Zoom-out for the current window. Non True-Type fonts may require multiple presses. |
Ctrl+Backspace | Delete the word to the left of the cursor. |
Ctrl+Z | Undo |
Ctrl+Y | Redo |
Ctrl+X | Cut |
Ctrl+C | Copy |
Ctrl+V | Paste |
Ctrl+A | Select All |
Ctrl+Shift+L | Delete the current line |
Ctrl+T | Transpose (swap) the current line with the line above |
Ctrl+U | Convert the selection to lower case |
Ctrl+Shift+U | Convert the selection to upper case |
Editor Specific Keystrokes
|
Description
|
| |
F2 | Move to the next bookmark. |
Ctrl+F2 | Add or remove a bookmark on the current line. |
Ctrl+G | Prompt for and goto a specific line number. |
Alt+B | Adds a simple comment banner at the current location. |
Alt+3 | Block comment the selected region. |
Shift+Alt+3 | Uncomment the selected region. |
Alt+4 | Uncomment the selected region (IDLE default keystroke) |
Alt+5 | Tabify the selected region.
|
Alt+6 | Untabify the selected region. |
BackSpace | Remove selected region or one character or indent to the left. |
Ctrl+T | Toggle the use of tabs for the current file (after confirmation) |
Alt+U | Change the indent width for the current file. |
Enter | Insert a newline and indent. |
Tab | Insert an indent, perform a block indent if a selection exists, or accept an attribute selection. |
Shift-Tab | Block dedent the selection
|
F6 | Toggle view when editor splitter is open.
|
Keypad-Plus | If the current line is a collapsed fold, expand it (see Folding
) |
Alt-Keypad-Plus | Expand all folds in the current file (see Folding
) |
Keypad-Minus | If the current line is an expanded fold, collapse it (see Folding
) |
Alt-Keypad-Minus | Collapse all folds in the current file. regardless of how deep the fold becomes. (see Folding
) |
Keypad-Multiply | Expand or collapse all top-level folds in the current file. No second level or deeper folds are changed.
If the first fold in the file is collapsed, all top-level folds are opened. Otherwise, all top-level folds are collapsed (see Folding
) |
Debugger Keystrokes
|
Description
|
| |
F9 | Toggle breakpoint |
F5 | Run (ie, go) |
Shift+F5 | Stop debugging |
F11 | Single step into functions |
F10 | Step over functions |
Shift+F11 | Step out of the current function |
Interactive Window Specific Keystrokes
|
Description
|
| |
Ctrl+Up | Recall the previous command in the history list. |
Ctrl+Down | Recall the next command in the history list. |