]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Change license to MIT
[VimFx.git] / extension / lib / defaults.coffee
1 # coffeelint: disable=colon_assignment_spacing
2 # coffeelint: disable=no_implicit_braces
3
4 # This file defines all VimFx’s options in an easy-to-read way.
5
6 shortcuts =
7 'normal':
8 'location':
9 'o': 'focus_location_bar'
10 'O': 'focus_search_bar'
11 'p': 'paste_and_go'
12 'P': 'paste_and_go_in_tab'
13 'yy': 'copy_current_url'
14 'gu': 'go_up_path'
15 'gU': 'go_to_root'
16 'gh': 'go_home'
17 'H': 'history_back'
18 'L': 'history_forward'
19 'gH': 'history_list'
20 'r': 'reload'
21 'R': 'reload_force'
22 'ar': 'reload_all'
23 'aR': 'reload_all_force'
24 's': 'stop'
25 'as': 'stop_all'
26
27 'scrolling':
28 'h': 'scroll_left'
29 'l': 'scroll_right'
30 'j': 'scroll_down'
31 'k': 'scroll_up'
32 '<space>': 'scroll_page_down'
33 '<s-space>': 'scroll_page_up'
34 'd': 'scroll_half_page_down'
35 'u': 'scroll_half_page_up'
36 'gg': 'scroll_to_top'
37 'G': 'scroll_to_bottom'
38 '0 ^': 'scroll_to_left'
39 '$': 'scroll_to_right'
40 'm': 'mark_scroll_position'
41 "'": 'scroll_to_mark'
42 'g[': 'scroll_to_previous_position'
43 'g]': 'scroll_to_next_position'
44
45 'tabs':
46 't': 'tab_new'
47 'T': 'tab_new_after_current'
48 'yt': 'tab_duplicate'
49 'J gT': 'tab_select_previous'
50 'K gt': 'tab_select_next'
51 'gl': 'tab_select_most_recent'
52 'gL': 'tab_select_oldest_unvisited'
53 'gJ': 'tab_move_backward'
54 'gK': 'tab_move_forward'
55 'gw': 'tab_move_to_window'
56 'g0': 'tab_select_first'
57 'g^': 'tab_select_first_non_pinned'
58 'g$': 'tab_select_last'
59 'gp': 'tab_toggle_pinned'
60 'x': 'tab_close'
61 'X': 'tab_restore'
62 'gX': 'tab_restore_list'
63 'gx$': 'tab_close_to_end'
64 'gxa': 'tab_close_other'
65
66 'browsing':
67 'f': 'follow'
68 'F': 'follow_in_tab'
69 'et': 'follow_in_focused_tab'
70 'ew': 'follow_in_window'
71 'ep': 'follow_in_private_window'
72 'af': 'follow_multiple'
73 'yf': 'follow_copy'
74 'ef': 'follow_focus'
75 'ec': 'open_context_menu'
76 'eb': 'click_browser_element'
77 '[': 'follow_previous'
78 ']': 'follow_next'
79 'gi': 'focus_text_input'
80 'v': 'element_text_caret'
81 'av': 'element_text_select'
82 'yv': 'element_text_copy'
83
84 'find':
85 '/': 'find'
86 'a/': 'find_highlight_all'
87 'g/': 'find_links_only'
88 'n': 'find_next'
89 'N': 'find_previous'
90
91 'misc':
92 'w': 'window_new'
93 'W': 'window_new_private'
94 'i': 'enter_mode_ignore'
95 'I': 'quote'
96 'gr': 'enter_reader_view'
97 'gB': 'edit_blacklist'
98 'gC': 'reload_config_file'
99 '?': 'help'
100 ':': 'dev'
101 '<force><escape>': 'esc'
102
103 'caret':
104 '':
105 'h': 'move_left'
106 'l': 'move_right'
107 'j': 'move_down'
108 'k': 'move_up'
109 'b': 'move_word_left'
110 'w': 'move_word_right'
111 '0 ^': 'move_to_line_start'
112 '$': 'move_to_line_end'
113 'v': 'toggle_selection'
114 'o': 'toggle_selection_direction'
115 'y': 'copy_selection_and_exit'
116 '<escape>': 'exit'
117
118 'hints':
119 '':
120 '<escape>': 'exit'
121 '<enter> \
122 <c-enter> \
123 <a-enter>': 'activate_highlighted'
124 '<c-space>': 'rotate_markers_forward'
125 '<s-space>': 'rotate_markers_backward'
126 '<backspace>': 'delete_char'
127 '<c-backspace>': 'toggle_complementary'
128 '<up>': 'increase_count'
129
130 'ignore':
131 '':
132 '<s-escape>': 'exit'
133 '<s-f1>': 'unquote'
134
135 'find':
136 '':
137 '<escape> <enter>': 'exit'
138
139 'marks':
140 '':
141 '<escape> ': 'exit'
142
143 options =
144 'prevent_autofocus': false
145 'ignore_keyboard_layout': false
146 'blacklist': '*example.com* http://example.org/editor/*'
147 'hints.chars': 'fjdkslaghrueiwonc mv'
148 'hints.auto_activate': true
149 'hints.timeout': 400
150 'timeout': 2000
151 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
152 'next_patterns': 'next › » ▶ → >> > more older'
153
154 advanced_options =
155 'notifications_enabled': true
156 'notify_entered_keys': true
157 'prevent_target_blank': true
158 'counts_enabled': true
159 'find_from_top_of_viewport': true
160 'browsewithcaret': false
161 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
162 'prevent_autofocus_modes': 'normal'
163 'config_file_directory': ''
164 'blur_timeout': 50
165 'refocus_timeout': 100
166 'smoothScroll.lines.spring-constant': '1000'
167 'smoothScroll.pages.spring-constant': '2500'
168 'smoothScroll.other.spring-constant': '2500'
169 'scroll.reset_timeout': 1000
170 'scroll.repeat_timeout': 65
171 'scroll.horizontal_boost': 6
172 'scroll.vertical_boost': 3
173 'scroll.full_page_adjustment': 40
174 'scroll.half_page_adjustment': 20
175 'scroll.last_position_mark': "'"
176 'scroll.last_find_mark': '/'
177 'pattern_selector': ':-moz-any(
178 a, button, input[type="button"]
179 ):not([role="menu"]):not([role="tab"])'
180 'pattern_attrs': 'rel role data-tooltip aria-label'
181 'hints.matched_timeout': 200
182 'hints.sleep': 15
183 'hints.match_text': true
184 'hints.peek_through': '<c-s->'
185 'hints.toggle_in_tab': '<c-'
186 'hints.toggle_in_background': '<a-'
187 'activatable_element_keys': '<enter>'
188 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
189 <arrowright> <space> <enter>'
190 'focus_previous_key': '<s-tab>'
191 'focus_next_key': '<tab>'
192 'options.key.quote': '<c-q>'
193 'options.key.insert_default': '<c-d>'
194 'options.key.reset_default': '<c-r>'
195
196 parsed_options =
197 'translations': {}
198 'categories': {} # Will be filled in below.
199
200
201
202 # The above easy-to-read data is transformed in to easy-to-consume (for
203 # computers) formats below.
204
205 # coffeelint: enable=colon_assignment_spacing
206 # coffeelint: enable=no_implicit_braces
207
208 translate = require('./translate')
209 utils = require('./utils')
210
211 addCategory = (category, order) ->
212 uncategorized = (category == '')
213 categoryName = if uncategorized then '' else translate("category.#{category}")
214 parsed_options.categories[category] = {
215 name: categoryName
216 order: if uncategorized then 0 else order
217 }
218
219 shortcut_prefs = {}
220 categoryMap = {}
221 mode_order = {}
222 command_order = {}
223
224 createCounter = -> new utils.Counter({step: 100})
225 modeCounter = createCounter()
226 categoryCounter = createCounter()
227
228 for modeName, modeCategories of shortcuts
229 mode_order[modeName] = modeCounter.tick()
230 for categoryName, modeShortcuts of modeCategories
231 addCategory(categoryName, categoryCounter.tick())
232 commandIndex = createCounter()
233 for shortcut, commandName of modeShortcuts
234 pref = "mode.#{modeName}.#{commandName}"
235 shortcut_prefs[pref] = shortcut
236 command_order[pref] = commandIndex.tick()
237 categoryMap[pref] = categoryName
238
239 # All options, excluding shortcut customizations.
240 all_options = Object.assign({}, options, advanced_options, parsed_options)
241 # All things that are saved in Firefox’s prefs system.
242 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
243
244 module.exports = {
245 options
246 advanced_options
247 parsed_options
248 all_options
249 shortcut_prefs
250 all_prefs
251 categoryMap
252 mode_order
253 command_order
254 BRANCH: 'extensions.VimFx.'
255 }
Imprint / Impressum