2 # Copyright Simon Lydell 2015, 2016.
4 # This file is part of VimFx.
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.
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.
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/>.
20 # coffeelint: disable=colon_assignment_spacing
21 # coffeelint: disable=no_implicit_braces
23 # This file defines all VimFx’s options in an easy-to-read way.
28 'o': 'focus_location_bar'
29 'O': 'focus_search_bar'
31 'P': 'paste_and_go_in_tab'
32 'yy': 'copy_current_url'
37 'L': 'history_forward'
42 'aR': 'reload_all_force'
51 '<space>': 'scroll_page_down'
52 '<s-space>': 'scroll_page_up'
53 'd': 'scroll_half_page_down'
54 'u': 'scroll_half_page_up'
56 'G': 'scroll_to_bottom'
57 '0 ^': 'scroll_to_left'
58 '$': 'scroll_to_right'
59 'm': 'mark_scroll_position'
64 'T': 'tab_new_after_current'
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'
79 'gX': 'tab_restore_list'
80 'gx$': 'tab_close_to_end'
81 'gxa': 'tab_close_other'
86 'et': 'follow_in_focused_tab'
87 'ew': 'follow_in_window'
88 'ep': 'follow_in_private_window'
89 'af': 'follow_multiple'
92 'ec': 'open_context_menu'
93 'eb': 'click_browser_element'
94 '[': 'follow_previous'
96 'gi': 'focus_text_input'
97 'v': 'element_text_caret'
98 'av': 'element_text_select'
99 'yv': 'element_text_copy'
103 'a/': 'find_highlight_all'
104 'g/': 'find_links_only'
110 'W': 'window_new_private'
111 'i': 'enter_mode_ignore'
113 'gr': 'enter_reader_view'
114 'gB': 'edit_blacklist'
115 'gC': 'reload_config_file'
118 '<force><escape>': 'esc'
126 'b': 'move_word_left'
127 'w': 'move_word_right'
128 '0 ^': 'move_to_line_start'
129 '$': 'move_to_line_end'
130 'v': 'toggle_selection'
131 'o': 'toggle_selection_direction'
132 'y': 'copy_selection_and_exit'
140 <a-enter>': 'activate_highlighted'
141 '<c-space>': 'rotate_markers_forward'
142 '<s-space>': 'rotate_markers_backward'
143 '<backspace>': 'delete_char'
144 '<c-backspace>': 'toggle_complementary'
145 '<up>': 'increase_count'
154 '<escape> <enter>': 'exit'
161 'prevent_autofocus': false
162 'ignore_keyboard_layout': false
163 'blacklist': '*example.com* http://example.org/editor/*'
164 'hints.chars': 'fjdkslaghrueiwonc mv'
165 'hints.auto_activate': true
168 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
169 'next_patterns': 'next › » ▶ → >> > more older'
172 'notifications_enabled': true
173 'notify_entered_keys': true
174 'prevent_target_blank': true
175 'counts_enabled': true
176 'find_from_top_of_viewport': true
177 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
178 'prevent_autofocus_modes': 'normal'
179 'config_file_directory': ''
181 'smoothScroll.lines.spring-constant': '1000'
182 'smoothScroll.pages.spring-constant': '2500'
183 'smoothScroll.other.spring-constant': '2500'
184 'scroll.reset_timeout': 1000
185 'scroll.horizontal_boost': 6
186 'scroll.vertical_boost': 3
187 'scroll.full_page_adjustment': 40
188 'scroll.half_page_adjustment': 20
189 'scroll.last_position_mark': "'"
190 'pattern_selector': ':-moz-any(
191 a, button, input[type="button"]
192 ):not([role="menu"]):not([role="tab"])'
193 'pattern_attrs': 'rel role data-tooltip aria-label'
194 'hints.matched_timeout': 200
196 'hints.match_text': true
197 'hints.peek_through': '<c-s->'
198 'hints.toggle_in_tab': '<c-'
199 'hints.toggle_in_background': '<a-'
200 'activatable_element_keys': '<enter>'
201 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
202 <arrowright> <space> <enter>'
203 'focus_previous_key': '<s-tab>'
204 'focus_next_key': '<tab>'
205 'options.key.quote': '<c-q>'
206 'options.key.insert_default': '<c-d>'
207 'options.key.reset_default': '<c-r>'
211 'categories': {} # Will be filled in below.
215 # The above easy-to-read data is transformed in to easy-to-consume (for
216 # computers) formats below.
218 # coffeelint: enable=colon_assignment_spacing
219 # coffeelint: enable=no_implicit_braces
221 translate = require('./translate')
222 utils = require('./utils')
224 addCategory = (category, order) ->
225 uncategorized = (category == '')
226 categoryName = if uncategorized then '' else translate("category.#{category}")
227 parsed_options.categories[category] = {
229 order: if uncategorized then 0 else order
237 createCounter = -> new utils.Counter({step: 100})
238 modeCounter = createCounter()
239 categoryCounter = createCounter()
241 for modeName, modeCategories of shortcuts
242 mode_order[modeName] = modeCounter.tick()
243 for categoryName, modeShortcuts of modeCategories
244 addCategory(categoryName, categoryCounter.tick())
245 commandIndex = createCounter()
246 for shortcut, commandName of modeShortcuts
247 pref = "mode.#{modeName}.#{commandName}"
248 shortcut_prefs[pref] = shortcut
249 command_order[pref] = commandIndex.tick()
250 categoryMap[pref] = categoryName
252 # All options, excluding shortcut customizations.
253 all_options = Object.assign({}, options, advanced_options, parsed_options)
254 # All things that are saved in Firefox’s prefs system.
255 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
267 BRANCH: 'extensions.VimFx.'