]> git.gir.st - VimFx.git/blob - extension/lib/defaults.coffee
Move the `gr` command to its intended position
[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 'gH': 'history_list'
36 'r': 'reload'
37 'R': 'reload_force'
38 'ar': 'reload_all'
39 'aR': 'reload_all_force'
40 's': 'stop'
41 'as': 'stop_all'
42
43 'scrolling':
44 'h': 'scroll_left'
45 'l': 'scroll_right'
46 'j': 'scroll_down'
47 'k': 'scroll_up'
48 '<space>': 'scroll_page_down'
49 '<s-space>': 'scroll_page_up'
50 'd': 'scroll_half_page_down'
51 'u': 'scroll_half_page_up'
52 'gg': 'scroll_to_top'
53 'G': 'scroll_to_bottom'
54 '0 ^': 'scroll_to_left'
55 '$': 'scroll_to_right'
56 'm': 'mark_scroll_position'
57 '`': 'scroll_to_mark'
58
59 'tabs':
60 't': 'tab_new'
61 'yt': 'tab_duplicate'
62 'J gT': 'tab_select_previous'
63 'K gt': 'tab_select_next'
64 'gJ': 'tab_move_backward'
65 'gK': 'tab_move_forward'
66 'gw': 'tab_move_to_window'
67 'g0': 'tab_select_first'
68 'g^': 'tab_select_first_non_pinned'
69 'g$': 'tab_select_last'
70 'gp': 'tab_toggle_pinned'
71 'x': 'tab_close'
72 'X': 'tab_restore'
73 'gX': 'tab_restore_list'
74 'gx$': 'tab_close_to_end'
75 'gxa': 'tab_close_other'
76
77 'browsing':
78 'f': 'follow'
79 'F': 'follow_in_tab'
80 'gf': 'follow_in_focused_tab'
81 'gF': 'follow_in_window'
82 'af': 'follow_multiple'
83 'yf': 'follow_copy'
84 'zf': 'follow_focus'
85 '[': 'follow_previous'
86 ']': 'follow_next'
87 'gi': 'focus_text_input'
88
89 'find':
90 '/': 'find'
91 'a/': 'find_highlight_all'
92 'g/': 'find_links_only'
93 'n': 'find_next'
94 'N': 'find_previous'
95
96 'misc':
97 'w': 'window_new'
98 'W': 'window_new_private'
99 'i': 'enter_mode_ignore'
100 'I': 'quote'
101 'gr': 'enter_reader_view'
102 '?': 'help'
103 ':': 'dev'
104 '<force><escape>': 'esc'
105
106 'hints':
107 '':
108 '<escape>': 'exit'
109 '<space>': 'rotate_markers_forward'
110 '<s-space>': 'rotate_markers_backward'
111 '<backspace>': 'delete_hint_char'
112 '<enter>': 'increase_count'
113
114 'ignore':
115 '':
116 '<s-escape>': 'exit'
117 '<s-f1>': 'unquote'
118
119 'find':
120 '':
121 '<escape> <enter>': 'exit'
122
123 options =
124 'hint_chars': 'fjdkslaghrueiwovncm'
125 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer'
126 'next_patterns': 'next › » ▶ → >> > more older'
127 'black_list': ''
128 'prevent_autofocus': false
129 'ignore_keyboard_layout': false
130 'timeout': 2000
131
132 advanced_options =
133 'notifications_enabled': true
134 'notify_entered_keys': true
135 'prevent_target_blank': true
136 'ignore_ctrl_alt': (Services.appinfo.OS == 'WINNT')
137 'prevent_autofocus_modes': 'normal'
138 'hints_timeout': 200
139 'smoothScroll.lines.spring-constant': '1000'
140 'smoothScroll.pages.spring-constant': '2500'
141 'smoothScroll.other.spring-constant': '2500'
142 'scroll.full_page_adjustment': 40
143 'scroll.half_page_adjustment': 20
144 'scroll.last_position_mark': '`'
145 'pattern_selector': 'a, button'
146 'pattern_attrs': 'rel role data-tooltip aria-label'
147 'hints_toggle_in_tab': '<c-'
148 'hints_toggle_in_background': '<a-'
149 'activatable_element_keys': '<enter>'
150 'adjustable_element_keys': '<arrowup> <arrowdown> <arrowleft>
151 <arrowright> <space> <enter>'
152 'focus_previous_key': '<s-tab>'
153 'focus_next_key': '<tab>'
154 'options.key.quote': '<c-q>'
155 'options.key.insert_default': '<c-d>'
156 'options.key.reset_default': '<c-r>'
157
158 parsed_options =
159 'translations': {}
160 'categories': {} # Will be filled in below.
161
162
163
164 # The above easy-to-read data is transformed in to easy-to-consume (for
165 # computers) formats below.
166
167 translate = require('./l10n')
168 utils = require('./utils')
169
170 addCategory = (category, order) ->
171 uncategorized = (category == '')
172 categoryName =
173 if uncategorized
174 -> ''
175 else
176 translate.bind(null, "category.#{category}")
177 parsed_options.categories[category] = {
178 name: categoryName
179 order: if uncategorized then 0 else order
180 }
181
182 shortcut_prefs = {}
183 categoryMap = {}
184 mode_order = {}
185 command_order = {}
186
187 createCounter = -> new utils.Counter({step: 100})
188 modeCounter = createCounter()
189 categoryCounter = createCounter()
190
191 for modeName, modeCategories of shortcuts
192 mode_order[modeName] = modeCounter.tick()
193 for categoryName, modeShortcuts of modeCategories
194 addCategory(categoryName, categoryCounter.tick())
195 commandIndex = createCounter()
196 for shortcut, commandName of modeShortcuts
197 pref = "mode.#{modeName}.#{commandName}"
198 shortcut_prefs[pref] = shortcut
199 command_order[pref] = commandIndex.tick()
200 categoryMap[pref] = categoryName
201
202 # All options, excluding shortcut customizations.
203 all_options = Object.assign({}, options, advanced_options, parsed_options)
204 # All things that are saved in Firefox’s prefs system.
205 all_prefs = Object.assign({}, options, advanced_options, shortcut_prefs)
206
207 module.exports = {
208 options
209 advanced_options
210 parsed_options
211 all_options
212 shortcut_prefs
213 all_prefs
214 categoryMap
215 mode_order
216 command_order
217 BRANCH: 'extensions.VimFx.'
218 }
Imprint / Impressum