]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Merge branch 'master' into develop
[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 'yt': 'tab_duplicate'
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'
75 'x': 'tab_close'
76 'X': 'tab_restore'
77 'gX': 'tab_restore_list'
78 'gx$': 'tab_close_to_end'
79 'gxa': 'tab_close_other'
80
81 'browsing':
82 'f': 'follow'
83 'F': 'follow_in_tab'
84 'gf': 'follow_in_focused_tab'
85 'gF': 'follow_in_window'
86 'af': 'follow_multiple'
87 'yf': 'follow_copy'
88 'zf': 'follow_focus'
89 'zF': 'click_browser_element'
90 '[': 'follow_previous'
91 ']': 'follow_next'
92 'gi': 'focus_text_input'
93
94 'find':
95 '/': 'find'
96 'a/': 'find_highlight_all'
97 'g/': 'find_links_only'
98 'n': 'find_next'
99 'N': 'find_previous'
100
101 'misc':
102 'w': 'window_new'
103 'W': 'window_new_private'
104 'i': 'enter_mode_ignore'
105 'I': 'quote'
106 'gr': 'enter_reader_view'
107 'zr': 'reload_config_file'
108 '?': 'help'
109 ':': 'dev'
110 '<force><escape>': 'esc'
111
112 'hints':
113 '':
114 '<escape>': 'exit'
115 '<space>': 'rotate_markers_forward'
116 '<s-space>': 'rotate_markers_backward'
117 '<backspace>': 'delete_hint_char'
118 '<enter>': 'increase_count'
119
120 'ignore':
121 '':
122 '<s-escape>': 'exit'
123 '<s-f1>': 'unquote'
124
125 'find':
126 '':
127 '<escape> <enter>': 'exit'
128
129 options =
130 'hint_chars': 'fjdkslaghrueiwovncm'
131 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
132 'next_patterns': 'next › » ▶ → >> > more older'
133 'black_list': ''
134 'prevent_autofocus': false
135 'ignore_keyboard_layout': false
136 'timeout': 2000
137
138 advanced_options =
139 'notifications_enabled': true
140 'notify_entered_keys': true
141 'prevent_target_blank': true
142 'counts_enabled': true
143 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
144 'prevent_autofocus_modes': 'normal'
145 'config_file_directory': ''
146 'hints_timeout': 200
147 'hints_sleep': 15
148 'smoothScroll.lines.spring-constant': '1000'
149 'smoothScroll.pages.spring-constant': '2500'
150 'smoothScroll.other.spring-constant': '2500'
151 'scroll.full_page_adjustment': 40
152 'scroll.half_page_adjustment': 20
153 'scroll.last_position_mark': '`'
154 'pattern_selector': ':-moz-any(
155 a, button, input[type="button"]
156 ):not([role="menu"]):not([role="tab"])'
157 'pattern_attrs': 'rel role data-tooltip aria-label'
158 'hints_toggle_in_tab': '<c-'
159 'hints_toggle_in_background': '<a-'
160 'activatable_element_keys': '<enter>'
161 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
162 <arrowright> <space> <enter>'
163 'focus_previous_key': '<s-tab>'
164 'focus_next_key': '<tab>'
165 'options.key.quote': '<c-q>'
166 'options.key.insert_default': '<c-d>'
167 'options.key.reset_default': '<c-r>'
168
169 parsed_options =
170 'translations': {}
171 'categories': {} # Will be filled in below.
172
173
174
175 # The above easy-to-read data is transformed in to easy-to-consume (for
176 # computers) formats below.
177
178 # coffeelint: enable=colon_assignment_spacing
179 # coffeelint: enable=no_implicit_braces
180
181 translate = require('./l10n')
182 utils = require('./utils')
183
184 addCategory = (category, order) ->
185 uncategorized = (category == '')
186 categoryName = if uncategorized then '' else translate("category.#{category}")
187 parsed_options.categories[category] = {
188 name: categoryName
189 order: if uncategorized then 0 else order
190 }
191
192 shortcut_prefs = {}
193 categoryMap = {}
194 mode_order = {}
195 command_order = {}
196
197 createCounter = -> new utils.Counter({step: 100})
198 modeCounter = createCounter()
199 categoryCounter = createCounter()
200
201 for modeName, modeCategories of shortcuts
202 mode_order[modeName] = modeCounter.tick()
203 for categoryName, modeShortcuts of modeCategories
204 addCategory(categoryName, categoryCounter.tick())
205 commandIndex = createCounter()
206 for shortcut, commandName of modeShortcuts
207 pref = "mode.#{modeName}.#{commandName}"
208 shortcut_prefs[pref] = shortcut
209 command_order[pref] = commandIndex.tick()
210 categoryMap[pref] = categoryName
211
212 # All options, excluding shortcut customizations.
213 all_options = Object.assign({}, options, advanced_options, parsed_options)
214 # All things that are saved in Firefox’s prefs system.
215 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
216
217 module.exports = {
218 options
219 advanced_options
220 parsed_options
221 all_options
222 shortcut_prefs
223 all_prefs
224 categoryMap
225 mode_order
226 command_order
227 BRANCH: 'extensions.VimFx.'
228 }
Imprint / Impressum