]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Fix text input refocus issue in GNOME
[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 'g[': 'scroll_to_previous_position'
62 'g]': 'scroll_to_next_position'
63
64 'tabs':
65 't': 'tab_new'
66 'T': 'tab_new_after_current'
67 'yt': 'tab_duplicate'
68 'J gT': 'tab_select_previous'
69 'K gt': 'tab_select_next'
70 'gl': 'tab_select_most_recent'
71 'gL': 'tab_select_oldest_unvisited'
72 'gJ': 'tab_move_backward'
73 'gK': 'tab_move_forward'
74 'gw': 'tab_move_to_window'
75 'g0': 'tab_select_first'
76 'g^': 'tab_select_first_non_pinned'
77 'g$': 'tab_select_last'
78 'gp': 'tab_toggle_pinned'
79 'x': 'tab_close'
80 'X': 'tab_restore'
81 'gX': 'tab_restore_list'
82 'gx$': 'tab_close_to_end'
83 'gxa': 'tab_close_other'
84
85 'browsing':
86 'f': 'follow'
87 'F': 'follow_in_tab'
88 'et': 'follow_in_focused_tab'
89 'ew': 'follow_in_window'
90 'ep': 'follow_in_private_window'
91 'af': 'follow_multiple'
92 'yf': 'follow_copy'
93 'ef': 'follow_focus'
94 'ec': 'open_context_menu'
95 'eb': 'click_browser_element'
96 '[': 'follow_previous'
97 ']': 'follow_next'
98 'gi': 'focus_text_input'
99 'v': 'element_text_caret'
100 'av': 'element_text_select'
101 'yv': 'element_text_copy'
102
103 'find':
104 '/': 'find'
105 'a/': 'find_highlight_all'
106 'g/': 'find_links_only'
107 'n': 'find_next'
108 'N': 'find_previous'
109
110 'misc':
111 'w': 'window_new'
112 'W': 'window_new_private'
113 'i': 'enter_mode_ignore'
114 'I': 'quote'
115 'gr': 'enter_reader_view'
116 'gB': 'edit_blacklist'
117 'gC': 'reload_config_file'
118 '?': 'help'
119 ':': 'dev'
120 '<force><escape>': 'esc'
121
122 'caret':
123 '':
124 'h': 'move_left'
125 'l': 'move_right'
126 'j': 'move_down'
127 'k': 'move_up'
128 'b': 'move_word_left'
129 'w': 'move_word_right'
130 '0 ^': 'move_to_line_start'
131 '$': 'move_to_line_end'
132 'v': 'toggle_selection'
133 'o': 'toggle_selection_direction'
134 'y': 'copy_selection_and_exit'
135 '<escape>': 'exit'
136
137 'hints':
138 '':
139 '<escape>': 'exit'
140 '<enter> \
141 <c-enter> \
142 <a-enter>': 'activate_highlighted'
143 '<c-space>': 'rotate_markers_forward'
144 '<s-space>': 'rotate_markers_backward'
145 '<backspace>': 'delete_char'
146 '<c-backspace>': 'toggle_complementary'
147 '<up>': 'increase_count'
148
149 'ignore':
150 '':
151 '<s-escape>': 'exit'
152 '<s-f1>': 'unquote'
153
154 'find':
155 '':
156 '<escape> <enter>': 'exit'
157
158 'marks':
159 '':
160 '<escape> ': 'exit'
161
162 options =
163 'prevent_autofocus': false
164 'ignore_keyboard_layout': false
165 'blacklist': '*example.com* http://example.org/editor/*'
166 'hints.chars': 'fjdkslaghrueiwonc mv'
167 'hints.auto_activate': true
168 'hints.timeout': 400
169 'timeout': 2000
170 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
171 'next_patterns': 'next › » ▶ → >> > more older'
172
173 advanced_options =
174 'notifications_enabled': true
175 'notify_entered_keys': true
176 'prevent_target_blank': true
177 'counts_enabled': true
178 'find_from_top_of_viewport': true
179 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
180 'prevent_autofocus_modes': 'normal'
181 'config_file_directory': ''
182 'blur_timeout': 50
183 'refocus_timeout': 100
184 'smoothScroll.lines.spring-constant': '1000'
185 'smoothScroll.pages.spring-constant': '2500'
186 'smoothScroll.other.spring-constant': '2500'
187 'scroll.reset_timeout': 1000
188 'scroll.horizontal_boost': 6
189 'scroll.vertical_boost': 3
190 'scroll.full_page_adjustment': 40
191 'scroll.half_page_adjustment': 20
192 'scroll.last_position_mark': "'"
193 'scroll.last_find_mark': '/'
194 'pattern_selector': ':-moz-any(
195 a, button, input[type="button"]
196 ):not([role="menu"]):not([role="tab"])'
197 'pattern_attrs': 'rel role data-tooltip aria-label'
198 'hints.matched_timeout': 200
199 'hints.sleep': 15
200 'hints.match_text': true
201 'hints.peek_through': '<c-s->'
202 'hints.toggle_in_tab': '<c-'
203 'hints.toggle_in_background': '<a-'
204 'activatable_element_keys': '<enter>'
205 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
206 <arrowright> <space> <enter>'
207 'focus_previous_key': '<s-tab>'
208 'focus_next_key': '<tab>'
209 'options.key.quote': '<c-q>'
210 'options.key.insert_default': '<c-d>'
211 'options.key.reset_default': '<c-r>'
212
213 parsed_options =
214 'translations': {}
215 'categories': {} # Will be filled in below.
216
217
218
219 # The above easy-to-read data is transformed in to easy-to-consume (for
220 # computers) formats below.
221
222 # coffeelint: enable=colon_assignment_spacing
223 # coffeelint: enable=no_implicit_braces
224
225 translate = require('./translate')
226 utils = require('./utils')
227
228 addCategory = (category, order) ->
229 uncategorized = (category == '')
230 categoryName = if uncategorized then '' else translate("category.#{category}")
231 parsed_options.categories[category] = {
232 name: categoryName
233 order: if uncategorized then 0 else order
234 }
235
236 shortcut_prefs = {}
237 categoryMap = {}
238 mode_order = {}
239 command_order = {}
240
241 createCounter = -> new utils.Counter({step: 100})
242 modeCounter = createCounter()
243 categoryCounter = createCounter()
244
245 for modeName, modeCategories of shortcuts
246 mode_order[modeName] = modeCounter.tick()
247 for categoryName, modeShortcuts of modeCategories
248 addCategory(categoryName, categoryCounter.tick())
249 commandIndex = createCounter()
250 for shortcut, commandName of modeShortcuts
251 pref = "mode.#{modeName}.#{commandName}"
252 shortcut_prefs[pref] = shortcut
253 command_order[pref] = commandIndex.tick()
254 categoryMap[pref] = categoryName
255
256 # All options, excluding shortcut customizations.
257 all_options = Object.assign({}, options, advanced_options, parsed_options)
258 # All things that are saved in Firefox’s prefs system.
259 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
260
261 module.exports = {
262 options
263 advanced_options
264 parsed_options
265 all_options
266 shortcut_prefs
267 all_prefs
268 categoryMap
269 mode_order
270 command_order
271 BRANCH: 'extensions.VimFx.'
272 }
Imprint / Impressum