]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Merge pull request #512 from akhodakivskiy/multi-process
[VimFx.git] / extension / lib / defaults.coffee
1 ###
2 # Copyright Simon Lydell 2015.
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 # This file defines all VimFx’s options in an easy-to-read way.
21
22 shortcuts =
23 'normal':
24 'location':
25 'o': 'focus_location_bar'
26 'O': 'focus_search_bar'
27 'p': 'paste_and_go'
28 'P': 'paste_and_go_in_tab'
29 'yy': 'copy_current_url'
30 'gu': 'go_up_path'
31 'gU': 'go_to_root'
32 'gh': 'go_home'
33 'H': 'history_back'
34 'L': 'history_forward'
35 'r': 'reload'
36 'R': 'reload_force'
37 'ar': 'reload_all'
38 'aR': 'reload_all_force'
39 's': 'stop'
40 'as': 'stop_all'
41
42 'scrolling':
43 'h': 'scroll_left'
44 'l': 'scroll_right'
45 'j': 'scroll_down'
46 'k': 'scroll_up'
47 '<space>': 'scroll_page_down'
48 '<s-space>': 'scroll_page_up'
49 'd': 'scroll_half_page_down'
50 'u': 'scroll_half_page_up'
51 'gg': 'scroll_to_top'
52 'G': 'scroll_to_bottom'
53 '0 ^': 'scroll_to_left'
54 '$': 'scroll_to_right'
55
56 'tabs':
57 't': 'tab_new'
58 'yt': 'tab_duplicate'
59 'J gT': 'tab_select_previous'
60 'K gt': 'tab_select_next'
61 'gJ': 'tab_move_backward'
62 'gK': 'tab_move_forward'
63 'g0': 'tab_select_first'
64 'g^': 'tab_select_first_non_pinned'
65 'g$': 'tab_select_last'
66 'gp': 'tab_toggle_pinned'
67 'x': 'tab_close'
68 'X': 'tab_restore'
69 'gx$': 'tab_close_to_end'
70 'gxa': 'tab_close_other'
71
72 'browsing':
73 'f': 'follow'
74 'F': 'follow_in_tab'
75 'gf': 'follow_in_focused_tab'
76 'af': 'follow_multiple'
77 'yf': 'follow_copy'
78 'zf': 'follow_focus'
79 '[': 'follow_previous'
80 ']': 'follow_next'
81 'gi': 'focus_text_input'
82 '<force><tab>': 'focus_next'
83 '<force><s-tab>': 'focus_previous'
84
85 'find':
86 '/': 'find'
87 'a/': 'find_highlight_all'
88 'n': 'find_next'
89 'N': 'find_previous'
90
91 'misc':
92 'i': 'enter_mode_ignore'
93 'I': 'quote'
94 '?': 'help'
95 ':': 'dev'
96 '<force><escape>': 'esc'
97
98 'hints':
99 '':
100 '<escape>': 'exit'
101 '<space>': 'rotate_markers_forward'
102 '<s-space>': 'rotate_markers_backward'
103 '<backspace>': 'delete_hint_char'
104 '<enter>': 'increase_count'
105
106 'ignore':
107 '':
108 '<s-escape>': 'exit'
109 '<s-f1>': 'unquote'
110
111 'find':
112 '':
113 '<escape> <enter>': 'exit'
114
115 options =
116 'hint_chars': 'fjdkslaghrueiwovncm'
117 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
118 'next_patterns': 'next › » ▶ → >> > more older'
119 'black_list': ''
120 'prevent_autofocus': true
121 'ignore_keyboard_layout': false
122 'timeout': 2000
123
124 advanced_options =
125 'prevent_target_blank': true
126 'autofocus_limit': 100
127 'prevent_autofocus_modes': 'normal'
128 'hints_timeout': 200
129 'smoothScroll.lines.spring-constant': '1000'
130 'smoothScroll.pages.spring-constant': '2500'
131 'smoothScroll.other.spring-constant': '2500'
132 'pattern_selector': 'a, button'
133 'pattern_attrs': 'rel role data-tooltip aria-label'
134 'hints_toggle_in_tab': '<c-'
135 'hints_toggle_in_background': '<a-'
136 'activatable_element_keys': '<enter>'
137 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
138 <arrowright> <space> <enter>'
139 'options.key.quote': '<c-q>'
140 'options.key.insert_default': '<c-d>'
141 'options.key.reset_default': '<c-r>'
142
143 parsed_options =
144 'translations': {}
145 'categories': {} # Will be filled in below.
146
147
148
149 # The above easy-to-read data is transformed in to easy-to-consume (for
150 # computers) formats below.
151
152 translate = require('./l10n')
153 utils = require('./utils')
154
155 addCategory = (category, order) ->
156 uncategorized = (category == '')
157 categoryName =
158 if uncategorized
159 -> ''
160 else
161 translate.bind(null, "category.#{ category }")
162 parsed_options.categories[category] = {
163 name: categoryName
164 order: if uncategorized then 0 else order
165 }
166
167 shortcut_prefs = {}
168 categoryMap = {}
169 mode_order = {}
170 command_order = {}
171
172 createCounter = -> new utils.Counter({step: 100})
173 modeCounter = createCounter()
174 categoryCounter = createCounter()
175
176 for modeName, modeCategories of shortcuts
177 mode_order[modeName] = modeCounter.tick()
178 for categoryName, modeShortcuts of modeCategories
179 addCategory(categoryName, categoryCounter.tick())
180 commandIndex = createCounter()
181 for shortcut, commandName of modeShortcuts
182 pref = "mode.#{ modeName }.#{ commandName }"
183 shortcut_prefs[pref] = shortcut
184 command_order[pref] = commandIndex.tick()
185 categoryMap[pref] = categoryName
186
187 # All options, excluding shortcut customizations.
188 all_options = Object.assign({}, options, advanced_options, parsed_options)
189 # All things that are saved in Firefox’s prefs system.
190 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
191
192 module.exports = {
193 options
194 advanced_options
195 parsed_options
196 all_options
197 shortcut_prefs
198 all_prefs
199 categoryMap
200 mode_order
201 command_order
202 BRANCH: 'extensions.VimFx.'
203 }
Imprint / Impressum