Guides/Qt IDE/Configure/User Keys

From J Wiki
< Guides‎ | Qt IDE‎ | Configure
Jump to navigation Jump to search
Overview  | Base  | Directory Match  | Folders  | Launch Pad  | Qt IDE  | Startup Script  | Styles  | User Keys

User-defined keys are given in file ~config/userkeys.cfg. Each non-comment line has the form:

key;mode;name;text

where:

key is the shortcut key preceded by the key state (required if not a function key). Valid key states are: Ctrl+, Shift+, or Ctrl+Shift+. For example:

F3
Ctrl+F3
Ctrl+Shift+H

mode indicates whether and how the J expression should be run, or just written to the window.

0=run silently
1=run with display
2=add as a new line to end of active window (do not run)
3=insert at cursor position in active window (do not run)
4=append to current line of active window (do not run)

name is the name shown in the Tools|Shortcuts menu

text is the text entered with the user key

Examples

F3;1;Minesweeper;load '~addons/games/minesweeper/uiwd.ijs'
Ctrl+H;0;Glossary;browse_j_'http://www.jsoftware.com/jwiki/Vocabulary/Glossary'

Notes

1. Where the mode is 0 or 1, the contents and selection of the active window are first written to globals WinText_jqtide_ and WinSelect_jqtide_. The selection is 2 integers - begin and end selection, which are just the cursor position if there is no selected text.

Note: if WinText_jqtide_ contains non-ASCII characters you must convert it to unicode before using WinSelect_jqtide_.

2. In mode 1, WinText_jqtide_ and WinSelect_jqtide_ are set; then the sentence assigned to the key is added to the term window; then the sentence is executed. This means that wd 'sm get term' executed in the sentence will include the new sentence, which WinText_jqtide_ does not. Moreover, if the cursor was at the end of the term window, it will be moved (to the end of the new sentence) at the point where the sentence is added to the window.

3. If the character ; is in the name or text, use any other ASCII character except + as delimiter. For example:

key|mode|name|text

4. Some shortcuts are required by the IDE and may not be remapped. The list of available keys is in the source at: lib/base/userkeys.cpp.