]> git.gir.st - VimFx.git/blob - documentation/shortcuts.md
Merge branch 'master' into develop
[VimFx.git] / documentation / shortcuts.md
1 <!--
2 This is part of the VimFx documentation.
3 Copyright Simon Lydell 2015.
4 See the file README.md for copying conditions.
5 -->
6
7 # Shortcuts
8
9 All of VimFx’s keyboard shortcuts can be customized in VimFx’s settings page in
10 the Add-ons Manager. Doing so is really easy. You get far just by looking at the
11 defaults and trying things out. If not, read on.
12
13
14 ## Key notation
15
16 VimFx’s key notation is inspired by Vim’s key notation. An example:
17
18 J gT <c-s-tab> g<left> <c-j>
19
20 The above defines five alternative shortcuts. The odd ones consist of one key
21 each, while the even ones consist of two. Letters can be written as they are,
22 while non-letter keys like Tab and the arrow keys need to be put inside `<` and
23 `>`. Letters also need to be put inside `<` and `>` if you want to specify a
24 modifier (as in the `<c-j>` example, which might be notated as “CTRL+J” in some
25 other programs.)
26
27 If you’re usure on how to express a key press you’d like to use as part of a
28 shortcut, press `<c-q>` while inside one of the text inputs for a command and
29 then press your desired key (optionally holding modifier keys). That will paste
30 the key notation for that particular key press into the text input. `<c-d>`
31 pastes the default shortcut(s), and `<c-r>` resets the text input to the default
32 entirely. You can of course use the standard `<c-z>` to undo.
33
34 You can specify any number of shortcuts for every command. Separate them from
35 each other by one or more spaces.
36
37 A _shortcut_ consists of one or more _keys_ that you need to press in order to
38 activate the command. (See also the [timeout] option.)
39
40 A _key_ corresponds to pressing a single key on your keyboard, optionally while
41 holding one or more _modifiers._ The following modifiers are recognized:
42
43 - a: alt
44 - c: control (also known as ctrl)
45 - m: meta
46 - s: shift
47
48 (Which of the above you can actually use depends on your operating system.)
49
50 If you’d like to know even more about the key notation, see
51 [vim-like-key-notation].
52
53 [timeout]: options.md#timeout
54 [vim-like-key-notation]: https://github.com/lydell/vim-like-key-notation
55
56
57 ## Tips
58
59 If you use more than one keyboard layout, remember to check out the [Ignore
60 keyboard layout] option.
61
62 If you’d like see what VimFx interprets a key stroke as, you can (ab)use the
63 [`m`] command. Press `m` followed by your desired key stroke. A [notification]
64 will appear, including the interpreted key notation for that key press.
65
66 [Ignore keyboard layout]: options.md#ignore-keyboard-layout
67 [`m`]: commands.md#marks-m-and-
68 [notification]: notifications.md
69
70
71 ## Special keys
72
73 Just like Vim, VimFx has a few “special keys:”
74
75 - [`<force>`]
76 - [`<late>`]
77
78 No keyboard (or keyboard layout) can produce those (in practise). As a
79 consequence, putting one of those “keys” in a shortcut would normally make it
80 impossible to trigger. However, that is not the case for special keys.
81
82 By putting a special key at the beginning of a shortcut, the shortcut will work
83 exactly as it would without the special key, except that some behavior of the
84 shortcut is changed (depending on the special key used). Special keys specify an
85 _option_ for the shortcut rather than a key to press in order to activate the
86 command.
87
88 Each special key is described below.
89
90 [`<force>`]: #force
91 [`<late>`]: #late
92
93 ### `<force>`
94
95 The `<force>` special key makes the shortcut in question available in text
96 inputs.
97
98 VimFx enters a kind of “automatic insert mode” when you focus a text input,
99 allowing you to type text into it without triggering VimFx commands. The `esc`
100 command, however, is still available, allowing you to blur the text input by
101 pressing `<escape>`. The reason it is available is because the default shortcut
102 is `<force><escape>`.
103
104 Using `<force>` allows you to run other commands in text inputs as well. For
105 example, you could use `<force><a-j>` and `<force><a-k>` to be able to select
106 tab backward and forward regardless if you happen to be in a text input or not.
107
108 ### `<late>`
109
110 The `<late>` special key makes the shortcut in question run _after_ the handling
111 of key presses in the current page, allowing the current page to override it.
112
113 Normally, all of VimFx’s shortcuts are triggered _before_ the current page gets
114 the key presses. This makes the VimFx shortcuts work consistently regardless of
115 what the current page happens to be up to.
116
117 Sometimes, though, it is useful to let the page override a shortcut. For
118 example, if you plan to use the arrow keys for VimFx’s scrolling commands, while
119 still being able to move the focus in the custom menus some sites use.
Imprint / Impressum