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