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'
65 'J gT': 'tab_select_previous'
66 'K gt': 'tab_select_next'
67 'gl': 'tab_select_most_recent'
68 'gJ': 'tab_move_backward'
69 'gK': 'tab_move_forward'
70 'gw': 'tab_move_to_window'
71 'g0': 'tab_select_first'
72 'g^': 'tab_select_first_non_pinned'
73 'g$': 'tab_select_last'
74 'gp': 'tab_toggle_pinned'
77 'gX': 'tab_restore_list'
78 'gx$': 'tab_close_to_end'
79 'gxa': 'tab_close_other'
84 'gf': 'follow_in_focused_tab'
85 'gF': 'follow_in_window'
86 'af': 'follow_multiple'
89 'zF': 'click_browser_element'
90 '[': 'follow_previous'
92 'gi': 'focus_text_input'
96 'a/': 'find_highlight_all'
97 'g/': 'find_links_only'
103 'W': 'window_new_private'
104 'i': 'enter_mode_ignore'
106 'gr': 'enter_reader_view'
109 '<force><escape>': 'esc'
114 '<space>': 'rotate_markers_forward'
115 '<s-space>': 'rotate_markers_backward'
116 '<backspace>': 'delete_hint_char'
117 '<enter>': 'increase_count'
126 '<escape> <enter>': 'exit'
129 'hint_chars': 'fjdkslaghrueiwovncm'
130 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
131 'next_patterns': 'next › » ▶ → >> > more older'
133 'prevent_autofocus': false
134 'ignore_keyboard_layout': false
138 'notifications_enabled': true
139 'notify_entered_keys': true
140 'prevent_target_blank': true
141 'counts_enabled': true
142 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
143 'prevent_autofocus_modes': 'normal'
146 'smoothScroll.lines.spring-constant': '1000'
147 'smoothScroll.pages.spring-constant': '2500'
148 'smoothScroll.other.spring-constant': '2500'
149 'scroll.full_page_adjustment': 40
150 'scroll.half_page_adjustment': 20
151 'scroll.last_position_mark': '`'
152 'pattern_selector': ':-moz-any(
153 a, button, input[type="button"]
154 ):not([role="menu"]):not([role="tab"])'
155 'pattern_attrs': 'rel role data-tooltip aria-label'
156 'hints_toggle_in_tab': '<c-'
157 'hints_toggle_in_background': '<a-'
158 'activatable_element_keys': '<enter>'
159 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
160 <arrowright> <space> <enter>'
161 'focus_previous_key': '<s-tab>'
162 'focus_next_key': '<tab>'
163 'options.key.quote': '<c-q>'
164 'options.key.insert_default': '<c-d>'
165 'options.key.reset_default': '<c-r>'
169 'categories': {} # Will be filled in below.
173 # The above easy-to-read data is transformed in to easy-to-consume (for
174 # computers) formats below.
176 # coffeelint: enable=colon_assignment_spacing
177 # coffeelint: enable=no_implicit_braces
179 translate = require('./l10n')
180 utils = require('./utils')
182 addCategory = (category, order) ->
183 uncategorized = (category == '')
184 categoryName = if uncategorized then '' else translate("category.#{category}")
185 parsed_options.categories[category] = {
187 order: if uncategorized then 0 else order
195 createCounter = -> new utils.Counter({step: 100})
196 modeCounter = createCounter()
197 categoryCounter = createCounter()
199 for modeName, modeCategories of shortcuts
200 mode_order[modeName] = modeCounter.tick()
201 for categoryName, modeShortcuts of modeCategories
202 addCategory(categoryName, categoryCounter.tick())
203 commandIndex = createCounter()
204 for shortcut, commandName of modeShortcuts
205 pref = "mode.#{modeName}.#{commandName}"
206 shortcut_prefs[pref] = shortcut
207 command_order[pref] = commandIndex.tick()
208 categoryMap[pref] = categoryName
210 # All options, excluding shortcut customizations.
211 all_options = Object.assign({}, options, advanced_options, parsed_options)
212 # All things that are saved in Firefox’s prefs system.
213 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
225 BRANCH: 'extensions.VimFx.'