]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Add the `<c-a>` Hints mode command to mark everything
[VimFx.git] / extension / lib / defaults.coffee
1 ###
2 # Copyright Simon Lydell 2015, 2016.
3 #
4 # This file is part of VimFx.
5 #
6 # VimFx is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # VimFx is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with VimFx. If not, see <http://www.gnu.org/licenses/>.
18 ###
19
20 # coffeelint: disable=colon_assignment_spacing
21 # coffeelint: disable=no_implicit_braces
22
23 # This file defines all VimFx’s options in an easy-to-read way.
24
25 shortcuts =
26 'normal':
27 'location':
28 'o': 'focus_location_bar'
29 'O': 'focus_search_bar'
30 'p': 'paste_and_go'
31 'P': 'paste_and_go_in_tab'
32 'yy': 'copy_current_url'
33 'gu': 'go_up_path'
34 'gU': 'go_to_root'
35 'gh': 'go_home'
36 'H': 'history_back'
37 'L': 'history_forward'
38 'gH': 'history_list'
39 'r': 'reload'
40 'R': 'reload_force'
41 'ar': 'reload_all'
42 'aR': 'reload_all_force'
43 's': 'stop'
44 'as': 'stop_all'
45
46 'scrolling':
47 'h': 'scroll_left'
48 'l': 'scroll_right'
49 'j': 'scroll_down'
50 'k': 'scroll_up'
51 '<space>': 'scroll_page_down'
52 '<s-space>': 'scroll_page_up'
53 'd': 'scroll_half_page_down'
54 'u': 'scroll_half_page_up'
55 'gg': 'scroll_to_top'
56 'G': 'scroll_to_bottom'
57 '0 ^': 'scroll_to_left'
58 '$': 'scroll_to_right'
59 'm': 'mark_scroll_position'
60 '`': 'scroll_to_mark'
61
62 'tabs':
63 't': 'tab_new'
64 'T': 'tab_new_after_current'
65 'yt': 'tab_duplicate'
66 'J gT': 'tab_select_previous'
67 'K gt': 'tab_select_next'
68 'gl': 'tab_select_most_recent'
69 'gL': 'tab_select_oldest_unvisited'
70 'gJ': 'tab_move_backward'
71 'gK': 'tab_move_forward'
72 'gw': 'tab_move_to_window'
73 'g0': 'tab_select_first'
74 'g^': 'tab_select_first_non_pinned'
75 'g$': 'tab_select_last'
76 'gp': 'tab_toggle_pinned'
77 'x': 'tab_close'
78 'X': 'tab_restore'
79 'gX': 'tab_restore_list'
80 'gx$': 'tab_close_to_end'
81 'gxa': 'tab_close_other'
82
83 'browsing':
84 'f': 'follow'
85 'F': 'follow_in_tab'
86 'gf': 'follow_in_focused_tab'
87 'gF': 'follow_in_window'
88 'af': 'follow_multiple'
89 'yf': 'follow_copy'
90 'zf': 'follow_focus'
91 'zF': 'click_browser_element'
92 '[': 'follow_previous'
93 ']': 'follow_next'
94 'gi': 'focus_text_input'
95
96 'find':
97 '/': 'find'
98 'a/': 'find_highlight_all'
99 'g/': 'find_links_only'
100 'n': 'find_next'
101 'N': 'find_previous'
102
103 'misc':
104 'w': 'window_new'
105 'W': 'window_new_private'
106 'i': 'enter_mode_ignore'
107 'I': 'quote'
108 'gr': 'enter_reader_view'
109 'zr': 'reload_config_file'
110 '?': 'help'
111 ':': 'dev'
112 '<force><escape>': 'esc'
113
114 'hints':
115 '':
116 '<escape>': 'exit'
117 '<space>': 'rotate_markers_forward'
118 '<s-space>': 'rotate_markers_backward'
119 '<backspace>': 'delete_hint_char'
120 '<enter>': 'increase_count'
121 '<c-a>': 'mark_everything'
122
123 'ignore':
124 '':
125 '<s-escape>': 'exit'
126 '<s-f1>': 'unquote'
127
128 'find':
129 '':
130 '<escape> <enter>': 'exit'
131
132 options =
133 'hint_chars': 'fjdkslaghrueiwovncm'
134 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
135 'next_patterns': 'next › » ▶ → >> > more older'
136 'blacklist': '*example.com* http://example.org/editor/*'
137 'prevent_autofocus': false
138 'ignore_keyboard_layout': false
139 'timeout': 2000
140
141 advanced_options =
142 'notifications_enabled': true
143 'notify_entered_keys': true
144 'prevent_target_blank': true
145 'counts_enabled': true
146 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
147 'prevent_autofocus_modes': 'normal'
148 'config_file_directory': ''
149 'hints_timeout': 200
150 'hints_sleep': 15
151 'smoothScroll.lines.spring-constant': '1000'
152 'smoothScroll.pages.spring-constant': '2500'
153 'smoothScroll.other.spring-constant': '2500'
154 'scroll.full_page_adjustment': 40
155 'scroll.half_page_adjustment': 20
156 'scroll.last_position_mark': '`'
157 'pattern_selector': ':-moz-any(
158 a, button, input[type="button"]
159 ):not([role="menu"]):not([role="tab"])'
160 'pattern_attrs': 'rel role data-tooltip aria-label'
161 'hints_toggle_in_tab': '<c-'
162 'hints_toggle_in_background': '<a-'
163 'activatable_element_keys': '<enter>'
164 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
165 <arrowright> <space> <enter>'
166 'focus_previous_key': '<s-tab>'
167 'focus_next_key': '<tab>'
168 'options.key.quote': '<c-q>'
169 'options.key.insert_default': '<c-d>'
170 'options.key.reset_default': '<c-r>'
171
172 parsed_options =
173 'translations': {}
174 'categories': {} # Will be filled in below.
175
176
177
178 # The above easy-to-read data is transformed in to easy-to-consume (for
179 # computers) formats below.
180
181 # coffeelint: enable=colon_assignment_spacing
182 # coffeelint: enable=no_implicit_braces
183
184 translate = require('./l10n')
185 utils = require('./utils')
186
187 addCategory = (category, order) ->
188 uncategorized = (category == '')
189 categoryName = if uncategorized then '' else translate("category.#{category}")
190 parsed_options.categories[category] = {
191 name: categoryName
192 order: if uncategorized then 0 else order
193 }
194
195 shortcut_prefs = {}
196 categoryMap = {}
197 mode_order = {}
198 command_order = {}
199
200 createCounter = -> new utils.Counter({step: 100})
201 modeCounter = createCounter()
202 categoryCounter = createCounter()
203
204 for modeName, modeCategories of shortcuts
205 mode_order[modeName] = modeCounter.tick()
206 for categoryName, modeShortcuts of modeCategories
207 addCategory(categoryName, categoryCounter.tick())
208 commandIndex = createCounter()
209 for shortcut, commandName of modeShortcuts
210 pref = "mode.#{modeName}.#{commandName}"
211 shortcut_prefs[pref] = shortcut
212 command_order[pref] = commandIndex.tick()
213 categoryMap[pref] = categoryName
214
215 # All options, excluding shortcut customizations.
216 all_options = Object.assign({}, options, advanced_options, parsed_options)
217 # All things that are saved in Firefox’s prefs system.
218 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
219
220 module.exports = {
221 options
222 advanced_options
223 parsed_options
224 all_options
225 shortcut_prefs
226 all_prefs
227 categoryMap
228 mode_order
229 command_order
230 BRANCH: 'extensions.VimFx.'
231 }
Imprint / Impressum